Introduction | Projects and Files | Statements | Expressions | Symbols | Types |
Attributes | Labels | Non-Member Functions | Constructing Declarations | Example Programs | Index |
Files are broken down into statements. SgStatement is the base class for the representation of statements. SgStatement has many derived classes, corresponding to the many different kinds of statements in the languages Sage++ can deal with.
Each statement has a unique integer identifier id,
and an integer variant tag which can be used to
identify its type. These are available through SgStatement's id()
and variant()
member functions. SgStatement's thebif
member provides access to the low level representation of statements,
known as the bif nodes.
Each statement has a context: it may have a lexical predecessor and a lexical successor, and it may be nested within a control block of another statement, or in a block structured definition like a C struct. This enclosing statement is called the control parent. It defines the basic structure of the parse tree.
Represents the fundamental class for all statements.
class SgStatement { public: PTR_BFND thebif; SgStatement(int variant); SgStatement(PTR_BFND bif); SgStatement(int code, SgLabel *lab, SgSymbol *symb, SgExpression *e1, SgExpression *e2, SgExpression *e3); // code is variant inline SgStatement(SgStatement &); // info about statement inline int lineNumber(); // source text line number inline int id(); // unique id; inline int variant(); // the type of the statement SgExpression *expr(int i); // i = 0,1,2 returns the i-th expression.inline int hasSymbol(); // returns TRUE if tmt has symbol, FALSE otherwise // returns the symbol field. Used by loop headers to point to the // loop variable symbol; Used by function and subroutine headers to // point to the function or subroutine name. SgSymbol *symbol(); // returns the symbol field. inline char *fileName(); inline int hasLabel(); // returns 1 if there is a label on the stmt. SgLabel *label(); // the label
// modifying the info. inline void setlineNumber(int n); // change the line number info inline void setId(int n); // cannot change the id info inline void setVariant(int n); // change the type of the statement void setExpression (int i, SgExpression &e); // change the i-th expression inline void setLabel(SgLabel &l); // change the label inline void setSymbol(SgSymbol &s); // change the symbol
// Control structure inline SgStatement *lexNext(); // the next statement in lexical order. inline SgStatement *lexPrev(); // the previous stmt in lexical order. inline SgStatement *controlParent(); // the enclosing control statement
inline void setLexNext(SgStatement &s); // change the lexical ordering void setControlParent(SgStatement &s); // change the control parent. void setControlParent(SgStatement *s); // change the control parent.
// Access statement using the tree structure // Describe BLOB lists here?
inline int numberOfChildrenList1(); inline int numberOfChildrenList2(); inline SgStatement *childList1(int i); inline SgStatement *childList2(int i); SgStatement *nextInChildList();
inline SgStatement *lastDeclaration(); inline SgStatement *lastExecutable(); inline SgStatement *lastNodeOfStmt(); inline SgStatement *nodeBefore(); inline void insertStmtBefore(SgStatement &s); inline void insertStmtBefore(SgStatement &s, SgStatement &cp); void insertStmtAfter(SgStatement &s); void insertStmtAfter(SgStatement &s, SgStatement &cp); inline SgStatement *extractStmt(); inline SgStatement *extractStmtBody(); inline void replaceWithStmt(SgStatement &s); inline void deleteStmt(); inline SgStatement © (void); inline SgStatement *copyPtr (void); inline SgStatement ©One (void); inline SgStatement *copyOnePtr (void); inline SgStatement ©Block (void); inline SgStatement *copyBlockPtr (void); inline int isIncludedInStmt(SgStatement &s); inline void replaceSymbByExp(SgSymbol &symb, SgExpression &exp); inline void replaceSymbBySymb(SgSymbol &symb, SgSymbol &newsymb); inline void replaceSymbBySymbSameName(SgSymbol &symb, SgSymbol &newsymb); inline void replaceTypeInStmt(SgType &old, SgType &newtype); char* unparse(); inline void unparsestdout(); void sunparse(char *buffer); //unparsing functions. inline char *comments(); //preceding comment lines. void addComment(char *com); /* ajm: setComments: set ALL of the node's comments */ inline void setComments (char *comments);
int numberOfComments(); //number of preceeding comments. CAREFUL!
int hasAnnotations(); //1 if there are annotations; 0 otherwise ~SgStatement(); // These function must be removed. Doesn't make sense here. int IsSymbolInScope(SgSymbol &symb); // TRUE if symbol is in scope int IsSymbolReferenced(SgSymbol &symb); inline SgStatement *getScopeForDeclare(); // return where a variable // can be declared;
/////////////// FOR ATTRIBUTES //////////////////////////
int numberOfAttributes(); int numberOfAttributes(int type); // of a specified type; void *attributeValue(int i); int attributeType(int i); void *attributeValue(int i,int type); // only considering one type attribute void *deleteAttribute(int i); void addAttribute(int type, void *a, int size); // void * can be NULL; void addAttribute(int type); //void * is NULL; void addAttribute(void *a, int size); //no type specifed; void addAttribute(SgAttribute *att); SgAttribute *getAttribute(int i); SgAttribute *getAttribute(int i,int type);
//////////// FOR DECL_SPECS (friend, inline, extern, static) ////////////
inline void addDeclSpec(int type); // type should be one of BIT_EXTERN, // BIT_INLINE, BIT_FRIEND, BIT_STATIC inline void clearDeclSpec(); // resets the decl_specs field to zero inline int isFriend(); // returns non-zero if friend modifier set // returns zero otherwise inline int isInline(); inline int isExtern(); inline int isStatic(); };
variant
.
bif
.
i
th expression.
(Note that i = 0, 1, 2
). There can be up to three expressions
associated with a statement. For example, the C for loop is of the
form for(expr_1; expr_2; expr_3)
.
void setExpression
(int i, SgExpression &e)
i
th expression to e
(see
the discussion of expressions associated with a statement, under
expr()
above).
void setLexNext
(SgStatement &s)
void setControlParent
(SgStatement &s)
SgStatement *childList1
(int i)
i
th statement in this statement's first
list of child statements.
SgStatement *childList2
(int i)
i
th statement in this statement's second
list of child statements.
SgStatement *nextInChildList
()
SgStatement *lastDeclaration
()
void insertStmtBefore
(SgStatement &s)
s
before this one.
void insertStmtBefore
(SgStatement &s, SgStatement &cp)
s
before this one. Set's s
's
control parent to cp
. (? is this right?)
void insertStmtAfter
(SgStatement &s)
s
after this one.
void insertStmtAfter
(SgStatement &s, SgStatement &cp)
s
after this one. Set's s
's
control parent to cp
. (? is this right?)
SgStatement *extractStmtBody
()
void replaceWithStmt
(SgStatement &s)
s
.
int isIncludedInStmt
(SgStatement &s)
void replaceSymbByExp
(SgSymbol &symb, SgExpression &exp)
void replaceSymbBySymb
(SgSymbol &symb, SgSymbol &newsymb)
void replaceSymbBySymbSameName
(SgSymbol &symb, SgSymbol &newsymb)
void replaceTypeInStmt
(SgType &old, SgType &newtype)
void setComment
(char *commments)
int IsSymbolInScope
(SgSymbol &symb)
int IsSymbolReferenced
(SgSymbol &symb)
SgStatement *getScopeForDeclare
()
A statement can have up to two lists of children statements. For
example, for an if
statement, all the statements in the "true"
branch belong to childList1
and all the statements in the "false"
branch belong to childList2
. For function definitions, all the
statements in the function body belong to childList1
.
Once a statement has been extracted from the parse tree one may make a
copy of it with copy()
and insert the copy or the original in
another position. For example, S1.insertStmtAfter(S2)
will
insert S2
in the lexical position following S1
.
One may also search a statement and its subexpressions for a symbol and replace all occurrences with another symbol or expression. Similarly, one may replace any reference to a given type with another type.
To illustrate the use of the statement classes consider the following simple example. Suppose we wish to traverse a file and apply the unrolling transformation to all the inner most loops whose body consists of only assignment statements. The function that accomplishes this is shown below.
void UnrollLoops(SgFile *file, int unroll_factor){ SgStatement *s = file->firstStatement(); SgForStmt *loop; while(s){ if(loop = isSgForStmt(s)){ if(loop->isAssignLoop()) loop->unrollLoop(unroll_factor); } s = s->lexNext(); } }
This function illustrates an important aspect of the programming style
used in Sage++. The main body of the function is a loop which scans
the statements in the file in lexical order. The variable s
is a
pointer to a generic statement object. There are two ways to tell if
a statement is a loop. One is to check to see if the variant is
FOR_NODE
. The other way is to use a special casting
function, in this case, isSgForStmt()
, which will check the variant
and return a pointer cast to the correct subclass or NULL
if it is not a match. Because C++ is a strongly typed language,
if we wish to apply the methods of the subclass, such a cast is necessary.
A function of the type
SgSUBCLASS * isSgSUBCLASS( SgBASECLASS *)is provided for each subclass of SgStatement, SgExpression and SgType. We feel that this mechanism is an effective way to use the strong typing of C++ to reduce errors.
Methods copyBlock()
and *copyBlockPtr()
copy all the remaining statements in the current block (i.e., with
the same control parent as the given statement) including the given
statement. All the children statements are copied as well. Warning:
things like block-copying of a statement that is itself a block-copy
of something else will not work because a statement returned by
copyBlock()
does not have a control parent.
Methods addDeclSpec(int type)
, clearDeclSpec()
,
isFriend()
, isInline()
, isExtern()
, and
isStatic()
are used to handle specifiers friend
,
extern
, static
, and inline
.
In older versions of Sage++ these were modifiers of type nodes.
Starting in July 1994, they are modifiers of statement (bif) nodes.
In order to set a particular modifier, use one of BIT_EXTERN
,
BIT_INLINE
, BIT_FRIEND
, or
BIT_STATIC
.
Here's an example illustrating the use of these methods:
#include <sage++user.h>main() { SgProject project("demo.proj");
for (int i = 0; i < project.numberOfFiles(); i++){ printf (" current file is %s\n", project.fileName(i)); SgFile *f; f = &(project.file(i)); SgStatement *s;
for ( s = f->firstStatement(); s; s = s->lexNext()){ if(s->isFriend()) printf("friend found in stmt with id %i-B\n",s->id()); if(s->isInline()) printf("inline found in stmt with id %i-B\n",s->id()); if(s->isStatic()) printf("static found in stmt with id %i-B\n",s->id()); if(s->isExtern()) printf("extern found in stmt with id %i-B\n",s->id()); s->clearDeclSpec(); } f->unparsestdout(); } }
SgStatement
is used in the following example programs:
All Languages:
C:
C++:
pC++:
Fortran:
Fortran 90:
Represents functions, for all languages.
class SgFuncHedrStmt: public SgProcHedrStmt { // Fortran and C function. // variant == FUNC_HEDR public: inline SgFuncHedrStmt(SgSymbol &name, SgStatement &Body); inline SgFuncHedrStmt(SgSymbol &name, SgType &type, SgStatement &Body); inline SgFuncHedrStmt(SgSymbol &name, SgSymbol &resultName, SgType &type, SgStatement &Body); inline SgFuncHedrStmt(SgSymbol &name); inline SgFuncHedrStmt(SgSymbol &name, SgExpression *exp); inline SgFuncHedrStmt(char *name); inline ~SgFuncHedrStmt(); inline SgSymbol *resultName(); // name of result variable.; int setResultName(SgSymbol &symbol); // set name of result variable.; inline SgType *returnedType(); // type of returned value inline void setReturnedType(SgType &type); // set type of returned value };
SgFuncHedrStmt
(SgSymbol &name, SgStatement Body)
SgFuncHedrStmt
(SgSymbol &name, SgType &type, SgStatement Body)
SgFuncHedrStmt
(SgSymbol &name, SgSymbol &resultName, SgType &type, SgStatement Body)
SgFuncHedrStmt
(SgSymbol &name)
int setResultName
(SgSymbol &symbol)
void setReturnedType
(SgType &type)
SgFuncHedrStmt
is used in the following example programs:
class SgBasicBlockStmt: public SgStatement { // in C we have: { body; } // variant == BASIC_BLOCK public: inline SgBasicBlockStmt(); inline ~SgBasicBlockStmt(); };
Not all statements that are compound statements in C and C++ are
represented as SgBasicBlockStmt
. Those that are not include:
function bodies, branches of if
statements, bodies of
while
statements, etc. Only those compound statements that
do not fall into the above category are represented as
SgBasicBlockStmt
. For example:
while(1){ int i; i = 0; }
includes no SgBasicBlockStmt
, whereas,
void foo(){ int i; { int j; j = 0; } i = 1; }
includes one SgBasicBlockStmt
.
SgBasicBlockStmt
is used in the following example programs:
class SgClassStmt: public {SgStatement} { // C++ class statement // class name : superclass_list ElementTypeOf collection_name { // body // } variables_list; // variant == CLASS_DECL, IDL_INTERFACE_DECL, IDL_MODULE_DECL, // IDL_EXCEPTION_DECL public: inline SgClassStmt(int variant); inline SgClassStmt(SgSymbol &name); inline SgClassStmt(int variant, SgSymbol &name); inline ~SgClassStmt(); inline int numberOfSuperClasses(); inline SgSymbol *name(); SgSymbol *superClass(int i); void setSuperClass(int i, SgSymbol &symb); void setSuperClass(int i, SgSymbol &symb, int access); //access = one of BIT_PRIVATE // BIT_PROTECTED // BIT_PUBLIC // BIT_PRIVATE | BIT_VIRTUAL // BIT_PROTECTED | BIT_VIRTUAL // BIT_PUBLIC | BIT_VIRTUAL };
A class declaration consists of a name, a list of super classes, a body consisting of public, private and protected functions and fields, and a list of variables that name instances, arrays of instances, pointers to instances and references to instances of the class.
void setSuperClass
(int i, SgSymbol &symb)
SgClassStmt
represents both forward declarations of classes,
as in:
class A;
and real class declarations (that is, definitions) as in:
class A { public: int field1; int field2; };
Declarations of the form,
class A a;
are also represented as SgClassStmt
's. But a declaration:
A a;
where A
has been declared as a class earlier, is a SgVarDeclStmt
.
Once a class has been defined, information about its fields can be acessed
using the methods of the SgClassType class. If cls
is a pointer to a
SgClassStmt
, then you can use
isSgClassType(cls->name()->type())
to get a pointer to the type.
A note about how superclasses (also known as base-clauses in C++ grammar) are represented. In a definition:
class A: public B, virtual private C {...};
the list
public B, virtual private C
is the base-clause.
Until Sage++ version 1.9, this list was stored as an EXPR_LIST
where each expression was a VAR_REF
whose variable was the
class name symbol. The public
, virtual
, etc. specifiers were
stored as T_DESCRIPT
type with no base class;
this type was attached to the VAR_REF
expression.
Starting with version 1.9, the representation of base-clause is also an
EXPR_LIST
containing VAR_REF
expressions;
however now the variables are "nameless" symbols (i.e., the names are
empty strings) and the information about the class and specifiers is stored
as type info (this is similar to the representation of the list of nameless
arguments in a function prototype). So, for example,
public B
is represented by a VAR_REF
, with symbol that does not have
a name. The type of the whole expression and the type of the symbol is
T_DESCRIPT
with BIT_PUBLIC
set;
the base type is T_DERIVED_TYPE
whose typeName is the
symbol for B
.
This representation is closer to the semantics of C++ and lets us refer to nested classes, as in
class A: private Outer::Inner{};
Similarly, for template base classes, as in
template<class T> class X: public S<T> { int j;};
the information about
public S<T>
is stored as the type info; in this case T_DESCRIPT
whose base class is T_DERIVED_TEMPLATE
, where template
name is the symbol for S
and the arguments field contains
information about T
. Before, information about T
was
stored as the right child of the VAR_REF
node.
Also starting with version 1.9, the unparser does not add the public:
specifier automatically. For example, before version 1.9,
class A: B{...};
would unparse to
class A: public B{...};
Now it unparses to
class A: B{...};
Also note that the old behavior could introduce bugs since a base class without explicitly specified access is not the same as public access! Furthermore, versions 1.7 and earlier had a bug where an empty class definition such as,
class A{};
would unparse to a class declaration,
class A;
Now it unparses to
class A { public: };
As you can see, placing the public:
inside is not perfect, but that
seems not to confuse any of the C++ compilers.
@sp 2
A new method, SgClassStmt::setSuperClass
, has been added.
It takes three arguments:
void SgClassStmt::setSuperClass(int i, SgSymbol &type_symb, int access)
the third argument gives the access modifier; it should be one of:
BIT_PRIVATE
, BIT_PROTECTED
,
BIT_PUBLIC
, BIT_PRIVATE
,
BIT_VIRTUAL
, BIT_PROTECTED
,
BIT_VIRTUAL
, BIT_PRIVATE
, or
BIT_VIRTUAL
.
SgClassStmt
is used in the following example programs:
class SgStructStmt: public SgClassStmt {// basic C++ structure // struct name ; // body // } variables_list; // variant == STRUCT_DECL public: // consider like a class. inline SgStructStmt(); inline SgStructStmt(SgSymbol &name); inline ~SgStructStmt(); };
SgClassStmt
class. The variant here is
STRUCT_DECL
. The remaining functionality is the same
as SgClassStmt
.
class SgUnionStmt: public SgClassStmt { // basic C++ structure // union name { // body // } variables_list; // variant == UNION_DECL public: // consider like a class. inline SgUnionStmt(); inline SgUnionStmt(SgSymbol &name); inline ~SgUnionStmt(); };
class SgEnumStmt: public SgClassStmt { // basic C++ structure // enum name { // body // } variables_list; // variant == ENUM_DECL public: // consider like a class. inline SgEnumStmt(); inline SgEnumStmt(SgSymbol &name); inline ~SgEnumStmt(); };
class SgCollectionStmt: public SgClassStmt { // basic C++ structure // collection name ; // body // } variables_list; // variant == COLLECTION_DECL public: inline SgCollectionStmt(); inline SgCollectionStmt(SgSymbol &name); inline ~SgCollectionStmt(); inline SgStatement *firstElementMethod(); };
SgCollectionStmt
(SgSymbol &name)
SgStatement *firstElementMethod
()
SgCollectionStmt
is used in the following example programs:
Represents Fortran program blocks.
class SgProgHedrStmt: public SgStatement { // fortran Program block // variant == PROG_HEDR public: inline SgProgHedrStmt(PTR_BFND bif); inline SgProgHedrStmt(int variant); inline SgProgHedrStmt(SgSymbol &name, SgStatement &Body); inline SgProgHedrStmt(SgSymbol &name); inline SgProgHedrStmt(char *name); inline SgSymbol &name(); inline void setName(SgSymbol &symbol); // set program nameinline int numberOfFunctionsCalled(); // the number of functions called inline SgSymbol *calledFunction(int i);// the i-th called function inline int numberOfStmtFunctions(); // the number of statement funcions; inline SgStatement *statementFunc(int i); // the i-th statement function; inline int numberOfEntryPoints(); // the number of entry points; inline SgStatement *entryPoint(int i); // the i-th entry point; inline int numberOfParameters(); // the number of parameters; inline SgSymbol *parameter(int i); // the i-th parameter inline int numberOfSpecificationStmts(); inline SgStatement *specificationStmt(int i); inline int numberOfExecutionStmts(); inline SgStatement *executionStmt(int i); inline int numberOfInternalFunctionsDefined(); inline SgStatement *internalFunction(int i); inline int numberOfInternalSubroutinesDefined(); inline SgStatement *internalSubroutine(int i); inline int numberOfInternalSubProgramsDefined(); inline SgStatement *internalSubProgram(int i); inline int isSymbolInScope(SgSymbol &symbol); inline int isSymbolDeclaredHere(SgSymbol &symbol); // global analysis data inline int numberOfVarsUsed(); // list of used variable access sections inline SgExpression *varsUsed(int i); // i-th var used section descriptor inline int numberofVarsMod(); // list of modifed variable access sections inline SgExpression *varsMod(int i); // i-th var mod section descriptor inline ~SgProgHedrStmt(); };
SgProgHedrStmt
(SgSymbol &name, SgStatement Body)
SgProgHedrStmt
(SgSymbol &name)
void setName
(SgSymbol &symbol)
SgSymbol *calledFunction
(int i)
SgStatement *statementFunc
(int i)
SgStatement *entryPoint
(int i)
int numberOfSpecificationStmts
()
SgStatement *specificationStmt
(int i)
SgStatement *executionStmt
(int i)
int numberOfInternalFunctionsDefined
()
SgStatement *internalFunction
(int i)
int numberOfInternalSubroutinesDefined
()
SgStatement *internalSubroutine
(int i)
int numberOfInternalSubProgramsDefined
()
SgStatement *internalSubProgram
(int i)
int isSymbolInScope
(SgSymbol &symbol)
int isSymbolDeclaredHere
(SgSymbol &symbol)
SgProgHedrStmt
is used in the following example programs:
Represents Fortran subroutines.
class SgProcHedrStmt: public SgProgHedrStmt { // Fortran subroutine // variant == PROC_HEDR public: inline SgProcHedrStmt(int variant); inline SgProcHedrStmt(SgSymbol &name, SgStatement &Body); inline SgProcHedrStmt(SgSymbol &name); inline SgProcHedrStmt(char *name); inline void AddArg(SgExpression &arg); SgExpression * AddArg(char *name, SgType &t); // returns decl expr created. SgExpression * AddArg(char *name, SgType &t, SgExpression &initializer); inline int isRecursive(); // 1 if recursive.; inline int numberOfEntryPoints(); // the number of entry points // other than the main, 0 for C funcs. inline SgStatement *entryPoint(int i); // the i-th entry point // this is incorrect. Takes only subroutines calls into account. // Should be modified to take function calls into account too. inline int numberOfCalls(); // number of calls to this proc. inline SgStatement *call(int i); // position of the i-th call. inline ~SgProcHedrStmt(); };
SgProcHedrStmt
(SgSymbol &name, SgStatement Body)
SgProcHedrStmt
(SgSymbol &name)
void AddArg
(SgExpression &arg)
SgStatement *entryPoint
(int i)
SgProcHedrStmt
is used in the following example programs:
Represents Fortran block data statements.
class SgBlockDataStmt: public SgStatement { // Fortran Block Data statement // variant == BLOCK_DATA public: SgBlockDataStmt(SgSymbol &name, SgStatement &body); ~SgBlockDataStmt(); SgSymbol *name(); // block data name if given; int setName(SgSymbol &symbol); // set block data name int isSymbolInScope(SgSymbol &symbol); int isSymbolDeclaredHere(SgSymbol &symbol); };
SgBlockDataStmt
(SgSymbol &name, SgStatement &body)
int isSymbolInScope
(SgSymbol &symbol)
int isSymbolDeclaredHere
(SgSymbol &symbol)
Represents Fortran 90 module
statements.
class SgModuleStmt: public SgStatement { // Fortran 90 Module statement // variant == MODULE_STMT public: SgModuleStmt(SgSymbol &moduleName, SgStatement &body); SgModuleStmt(SgSymbol &moduleName); ~SgModuleStmt(); SgSymbol *moduleName(); // module name void setName(SgSymbol &symbol); // set module name int numberOfSpecificationStmts(); int numberOfRoutinesDefined(); int numberOfFunctionsDefined(); int numberOfSubroutinesDefined(); SgStatement *specificationStmt(int i); SgStatement *routine(int i); SgStatement *function(int i); SgStatement *subroutine(int i); int isSymbolInScope(SgSymbol &symbol); int isSymbolDeclaredHere(SgSymbol &symbol); SgSymbol &addVariable(SgType &T, char *name); //add a declaration for new variable SgStatement *addCommonBlock(char *blockname, int noOfVars, SgSymbol *Vars); // add a new common block };
SgModuleStmt
(SgSymbol &moduleName, SgStatement &body)
SgModuleStmt
(SgSymbol &moduleName)
void setName
(SgSymbol &symbol)
int numberOfSpecificationStmts
()
int numberOfFunctionsDefined
()
int numberOfSubroutinesDefined
()
SgStatement *specificationStmt
(int i)
SgStatement *subroutine
(int i)
int isSymbolInScope
(SgSymbol &symbol)
int isSymbolDeclaredHere
(SgSymbol &symbol)
SgSymbol &addVariable
(SgType &T, char *name)
SgStatement *addCommonBlock
(char *blockname, int noOfVars, SgSymbol *Vars)
Represents Fortran 90 operator interface statements.
class SgInterfaceStmt: public SgStatement { // Fortran 90 Operator Interface Statement // variant == INTERFACE_STMT public: SgInterfaceStmt(SgSymbol &name, SgStatement &body, SgStatement &scope); ~SgInterfaceStmt(); SgSymbol *interfaceName(); // interface name if given int setName(SgSymbol &symbol); // set interface name int numberOfSpecificationStmts(); SgStatement *specificationStmt(int i); int isSymbolInScope(SgSymbol &symbol); int isSymbolDeclaredHere(SgSymbol &symbol); };
SgInterfaceStmt
(SgSymbol &name, SgStatement &body, SgStatement &scope)
int numberOfSpecificationStmts
()
SgStatement *specificationStmt
(int i)
int isSymbolInScope
(SgSymbol &symbol)
int isSymbolDeclaredHere
(SgSymbol &symbol)
All Languages:
Fortran:
Fortran 90:
Represents base class for declaration statements.
class SgDeclarationStatement: public SgStatement { // Declaration class // abstract class public: inline SgDeclarationStatement(int variant); inline ~SgDeclarationStatement(); inline SgExpression *varList(); inline int numberOfVars(); inline SgExpression *var(int i); inline void deleteVar(int i); inline void deleteTheVar(SgExpression &var); inline void addVar(SgExpression &exp); };
SgDeclarationStatement
(int variant)
void deleteTheVar
(SgExpression &var)
void addVar
(SgExpression &exp)
Represents declaration statements, for all languages.
class SgVarDeclStmt: public SgDeclarationStatement { // Declaration Statement // variant == VAR_DECL public: // varRefValList is a list of low-level nodes of // variants VAR_REFs or ARRAY_REFs or ASSIGN_OPs inline SgVarDeclStmt(SgExpression &varRefValList, SgExpression &attributeList, SgType &type); inline SgVarDeclStmt(SgExpression &varRefValList, SgType &type); inline SgVarDeclStmt(SgExpression &varRefValList); inline ~SgVarDeclStmt(); inline SgType *type(); // the type; inline int numberOfAttributesF90(); // the number of F90 attributes; // the attributes are: PARAMETER_OP | PUBLIC_OP | // PRIVATE_OP | ALLOCATABLE_OP | EXTERNAL_OP | // OPTIONAL_OP | POINTER_OP | SAVE_OP TARGET_OP inline int numberOfSymbols(); // the number of variables declared; inline SgSymbol *symbol(int i); inline void deleteSymbol(int i); inline void deleteTheSymbol(SgSymbol &symbol); inline SgExpression *initialValue(int i); // the initial value of the // i-th variable SgExpression *completeInitialValue(int i); // The complete ASSGN_OP // expression of the initial value *BW* from M. Golden void setInitialValue(int i, SgExpression &initVal); // sets the initial // value ofthe i-th variable; this is an // alternative way to initialize variables. // The low-level node (VAR_REF or ARRAY_REF) // is replaced by a ASSIGN_OP low-level node. void clearInitialValue(int i); // removes initial value of the i-th // declaration };
Below, varRefValList
is a list of low-level nodes of
variants VAR_REF
s or ARRAY_REF
s or
ASSIGN_OP
s.
SgVarDeclStmt
(SgExpression &varRefValList, SgExpression &attributeList, SgType &type)
SgVarDeclStmt
(SgExpression &varRefValList, SgType &type)
PARAMETER_OP
, PUBLIC_OP
,
PRIVATE_OP
, ALLOCATABLE_OP
,
EXTERNAL_OP
, OPTIONAL_OP
,
POINTER_OP
, or SAVE_OP TARGET_OP
.
This method was called numberOfAttributes
in Sage++ versions 1.7
and earlier. The name was changed to avoid conflicts with
numberOfAttributes
method for SgAttributes.
void deleteTheSymbol
(SgSymbol &symbol)
SgExpression *initialValue
(int i)
SgExpression *completeInitialValue
(int i)
ASSGN_OP
expression
containing the initial value, for i = 0, 1, 2, ...
void setInitialValue
(int i, SgExpression &initVal)
i
th declaration, for
i = 0, 1, 2, ...
NOTE: There are some methods in the SgSymbol class that can be very useful for constructing SgVarDeclStmt once the symbol exists.
SgVarDeclStmt
is used in the following example programs:
Represents lists of variable declarations, for all languages.
class SgVarListDeclStmt: public SgDeclarationStatement { // Declaration Statement // variant == INTENT_STMT, OPTIONAL_STMT, SAVE_STMT, PUBLIC_STMT, // PRIVATE_STMT, EXTERNAL_STAT, INTRINSIC_STAT, DIM_STAT, // ALLOCATABLE_STAT, POINTER_STAT, TARGET_STAT, MODULE_PROC_STMT public: SgVarListDeclStmt(int variant, SgExpression &symbolRefList); SgVarListDeclStmt(int variant, SgSymbol &symbolList, SgStatement &scope);inline ~SgVarListDeclStmt(); inline int numberOfSymbols(); inline SgSymbol *symbol(int i); inline void appendSymbol(SgSymbol &symbol); inline void deleteSymbol(int i); inline void deleteTheSymbol(SgSymbol &symbol); };
SgVarListDeclStmt
(int variant, SgExpression &symbolRefList)
SgVarListDeclStmt
(int variant, SgSymbol &symbolList, SgStatement &scope)
void appendSymbol
(SgSymbol &symbol)
void deleteTheSymbol
(SgSymbol &symbol)
SgVarListDeclStmt
is used in the following example programs:
Represents Fortran lists of lists of variable declarations.
class SgNestedVarListDeclStmt: public SgDeclarationStatement { // Declaration statement // variant == NAMELIST_STAT, EQUI_STAT, COMM_STAT, // and PROS_COMM for Fortran M // These statements have the format of a list of variable lists. For example, // EQUIVALENCE (A, C, D), (B, G, F), .... public: SgNestedVarListDeclStmt(int variant, SgExpression &listOfVarList); // varList must be of low-level variant appropriate to variant. For example, // if the variant is COMM_STAT, listOfVarList must be of variant COMM_LIST. ~SgNestedVarListDeclStmt(); SgExpression *lists(); int numberOfLists(); SgExpression *list(int i); void addList(SgExpression &list); void addVarToList(SgExpression &varRef); void deleteList(int i); void deleteTheList(SgExpression &list); void deleteVarInList(int i, SgExpression &varRef); void deleteVarInTheList(SgExpression &list, SgExpression &varRef); };
SgNestedVarListDeclStmt
(int variant, SgExpression &listOfVarList)
SgExpression *leadingVar
(int i)
void addList
(SgExpression &list)
void addVarToList
(SgExpression &varRef)
void deleteTheList
(SgExpression &list)
void deleteVarInList
(int i, SgExpression &varRef)
void deleteVarInTheList
(SgExpression &list, SgExpression &varRef)
SgNestedVarListDeclStmt
is used in the following example programs:
class SgParameterStmt: public SgDeclarationStatement { // Fortran constants declaration statement // variant = PARAM_DECL public: SgParameterStmt(SgExpression &constants, SgExpression &values); SgParameterStmt(SgExpression &constantsWithValues); ~SgParameterStmt(); int numberOfConstants(); // the number of constants declared SgSymbol *constant(int i); // the i-th variable SgExpression *value(int i); // the value of i-th variable void addConstant(SgSymbol &constant, SgExpression &value); void deleteConstant(int i); void deleteTheConstant(SgSymbol &constant); };
SgParameterStmt
(SgExpression &constants, SgExpression &values)
SgParameterStmt
(SgExpression &constantsWithValues)
void addConstant
(SgSymbol &constant, SgExpression &value)
void deleteTheConstant
(SgSymbol &constant)
SgParameterStmt
is used in the following example programs:
Represents Fortran implicit type declarations.
class SgImplicitStmt: public SgDeclarationStatement { // Fortran implicit type declaration statement // variant = IMPL_DECL public: SgImplicitStmt(SgExpression &implicitLists); ~SgImplicitStmt(); int numberOfImplicitTypes(); // the number of implicit types declared; SgType *implicitType(int i); // the i-th implicit type SgExpression *implicitRangeList(int i) ; void appendImplicitNode(SgExpression &impNode); };
SgImplicitStmt
(SgExpression &implicitLists)
SgExpression *implicitRangeList
(int i)
void appendImplicitNode
(SgExpression &impNode)
void addImplicitType
(SgType Type, char alphabet[])
int deleteTheImplicitItem
(SgExpression &implicitItem)
SgImplicitStmt
is used in the following example programs:
Represents Fortran statement function declarations.
class SgStmtFunctionStmt: public SgDeclarationStatement { // Fortran statement function declaration // variant == STMTFN_DECL public: SgStmtFunctionStmt(SgSymbol &name, SgExpression &args, SgStatement Body); ~SgStmtFunctionStmt(); SgSymbol *name(); void setName(SgSymbol &name); SgType *type(); int numberOfParameters(); // the number of parameters SgSymbol *parameter(int i); // the i-th parameter };
SgStmtFunctionStmt
(SgSymbol &name, SgExpression &args, SgStatement Body)
Represents Fortran 90 structure declarations.
class SgStructureDeclStmt: public SgDeclarationStatement { // Fortran 90 structure declaration statement // variant == STRUCT_DECL public: SgStructureDeclStmt(SgSymbol &name, SgExpression &attributes, SgStatement &body); ~SgStructureDeclStmt(); };
SgStructureDeclStmt
(SgSymbol &name, SgExpression &attributes, SgStatement &body)
SgStructureDeclStmt
is used in the following example programs:
Represents Fortran 90 module usage statements.
class SgUseStmt: public SgDeclarationStatement { // Fortran 90 module usuage statement // variant = USE_STMT public: SgUseStmt(SgSymbol &moduleName, SgExpression &renameList, SgStatement &scope); // renameList must be a list of low-level nodes of variant RENAME_NODE ~SgUseStmt(); int isOnly(); SgSymbol *moduleName(); void setModuleName(SgSymbol &moduleName); int numberOfRenames(); SgExpression *renameNode(int i); void addRename(SgSymbol &localName, SgSymbol &useName); void addRenameNode(SgExpression &renameNode); void deleteRenameNode(int i); void deleteTheRenameNode(SgExpression &renameNode); };
SgUseStmt
(SgSymbol &moduleName, SgExpression &renameList, SgStatement &scope)
void setModuleName
(SgSymbol &moduleName)
SgExpression *renameNode
(int i)
void addRename
(SgSymbol &localName, SgSymbol &useName)
void addRenameNode
(SgExpression &renameNode)
void deleteTheRenameNode
(SgExpression &renameNode)
Represents Fortran 90 contains statements, private statements, sequence statements.
class SgMiscellStmt: public SgDeclarationStatement { #if 0 // Fortran 90 simple miscellaneous statements // variant == CONTAINS_STMT, PRIVATE_STMT, SEQUENCE_STMT public: SgMiscellStmt(int variant); ~SgMiscellStmt(); };
Loops:
All Languages:
C:
Conditionals:
All Languages:
Fortran:
This class has a set of high level functions for semantic analysis and transformations. This includes the analysis of implicit induction variables defined in the loop body as well as information about the interactions with other loops that may be in the same loop nest. In addition, there are functions for performing very high level transformations such as normalization, interchange, unrolling, and fusion. However, in the current version, many of these functions are still unimplemented because they depend on data dependency information.
class SgForStmt: public SgStatement { // for Fortran Do and C for(); // variant = FOR_NODE public: inline SgForStmt(SgSymbol &do_var, SgExpression &start, SgExpression &end, SgExpression &step, SgStatement &body); inline SgForStmt(SgSymbol *do_var, SgExpression *start, SgExpression *end, SgExpression *step, SgStatement *body); inline SgForStmt(SgSymbol &do_var, SgExpression &start, SgExpression &end, SgStatement &body); inline SgForStmt(SgExpression &start, SgExpression &end, SgExpression &step, SgStatement &body); inline SgSymbol * doName(); // the name of the loop (for F90.) inline void setDoName(SgSymbol &doName);// sets the name of the loop(for F90)inline SgExpression *start(); inline void setStart(SgExpression &lbound);
inline SgExpression *end(); inline void setEnd(SgExpression &ubound);
inline SgExpression *step(); inline void setStep(SgExpression &step);
inline SgLabel *endOfLoop();
// body is returned with control end statement // still attached. inline SgStatement *body(); // s is assumed to terminate with a // control end statement. inline void set_body(SgStatement &s); inline int isPerfectLoopNest(); inline SgStatement *getNextLoop(); inline SgStatement *getPreviousLoop(); // returns outer nested loop inline SgStatement *getInnermostLoop(); // returns innermost nested loop inline int isEnddoLoop(); // TRUE if the loop ends with an Enddo inline int convertLoop(); // Convert the loop into a Good loop. inline ~SgForStmt(); };
SgForStmt
(SgSymbol &do_var, SgExpression &start, SgExpression &end, SgExpression &step, SgStatement &body)
SgForStmt
(SgSymbol *do_var, SgExpression *start, SgExpression *end, SgExpression *step, SgStatement *body)
SgForStmt
(SgSymbol &do_var, SgExpression &start, SgExpression &end, SgStatement &body)
SgForStmt
(SgExpression &start, SgExpression &end, SgExpression &step, SgStatement &body)
void setDoName
(SgSymbol &doName)
void setStart
(SgExpression &lbound)
void setEnd
(SgExpression &ubound)
void setStep
(SgExpression &step)
void setBounds
(SgTripletOp &bounds)
SgStatement *getPreviousLoop
()
SgStatement *getInnermostLoop
()
SgForStmt
is used in the following example programs:
Represents the C do...while
and Fortran dowhile
statements.
class SgDoWhileStmt: public SgWhileStmt { // For Fortran dowhile().. and C do {....) while(); // variant = DO_WHILE_NODE public: inline SgDoWhileStmt(SgExpression &cond, SgStatement &body); inline ~SgDoWhileStmt(); };
SgDoWhileStmt
(SgExpression &cond, SgStatement &body)
Represents the C while()
statement.
class SgWhileStmt: public SgStatement { // for C while() // variant = WHILE_NODE public: inline SgWhileStmt(int variant); inline SgWhileStmt(SgExpression &cond, SgStatement &body); inline SgExpression *conditional(); // the while test inline void replaceBody(SgStatement &s); // new body = s and lex successors. inline ~SgWhileStmt(); };
SgWhileStmt
(SgExpression &cond, SgStatement &body)
void replaceBody
(SgStatement &s)
SgWhileStmt
is used in the following example programs:
Represents the C if
and Fortran if .. then .. else
statement.
class SgIfStmt: public SgStatement { // For Fortran if then else and C if() // variant == IF_NODE public: inline SgIfStmt(int variant); inline SgIfStmt(SgExpression &cond, SgStatement &trueBody, SgStatement &falseBody, SgSymbol &construct_name); inline SgIfStmt(SgExpression &cond, SgStatement &trueBody, SgStatement &falseBody); inline SgIfStmt(SgExpression &cond, SgStatement &trueBody); inline SgStatement *trueBody(); // the first stmt in the True clause // SgBlock is needed? inline SgStatement *trueBody(int i); // i-th stmt in True clause, i=0,1,... inline SgStatement *falseBody(); // the first stmt in the False inline SgStatement *falseBody(int i);// i-th stmt of the body, i=0,1,... inline SgExpression *conditional(); // the while test inline SgSymbol *construct_name(); inline void replaceTrueBody(SgStatement &s);// new body=s and lex successors. inline void replaceFalseBody(SgStatement &s);//new body=s and lex successors. inline ~SgIfStmt(); };
SgIfStmt
(SgExpression &cond, SgStatement &trueBody, SgStatement &falseBody, SgSymbol &construct_name)
SgIfStmt
(SgExpression &cond, SgStatement &trueBody, SgStatement &falseBody)
SgIfStmt
(SgExpression &cond, SgStatement &trueBody)
void replaceTrueBody
(SgStatement &s)
void replaceFalseBody
(SgStatement &s)
SgIfStmt
is used in the following example programs:
Represents the C switch
and Fortran case
statement.
class SgSwitchStmt: public SgStatement { // Fortran Case and C switch(); // variant == SWITCH_NODE public: inline SgSwitchStmt(SgExpression &selector, SgStatement &caseOptionList, SgSymbol &constructName); inline SgSwitchStmt(SgExpression &selector, SgStatement * caseOptionList, SgSymbol &constructName); inline SgSwitchStmt(SgExpression &selector, SgStatement * caseOptionList, SgSymbol *constructName); inline ~SgSwitchStmt(); inline SgExpression *selector(); // the switch selector inline void setSelector(SgExpression &cond); inline int numberOfCaseOptions(); // the number of cases inline SgStatement *caseOption(int i); // i-th case block inline void addCaseOption(SgStatement &caseOption); };
SgSwitchStmt
(SgExpression &selector, SgStatement &caseOptionList, SgSymbol &constructName)
void setSelector
(SgExpression &cond)
SgStatement *caseOption
(int i)
void addCaseOption
(SgStatement &caseOption)
Represents the Fortran logical if
statement.
class SgLogIfStmt: public SgStatement { // For Fortran logical if - only one body statement allowed // variant == LOGIF_NODE public: inline SgLogIfStmt(int variant); inline SgLogIfStmt(SgExpression &cond, SgStatement &s); inline SgStatement *body(); // returns reference to first stmt in the body inline SgExpression *conditional(); // the while test // check if the statement s is a single statement. inline void setBody(SgStatement &s); // new body = s // this code won't work, since after the addition false // clause, it should become SgIfThenElse statement. inline void addFalseClause(SgStatement &s); // make it into if-then-else inline SgIfStmt *convertLogicIf(); inline ~SgLogIfStmt(); };
SgLogIfStmt
(SgExpression &cond, SgStatement &s)
void addFalseClause
(SgStatement &s)
SgLogIfStmt
is used in the following example programs:
Represents the Fortran if .. then .. elseif
statement.
class SgIfElseIfStmt: public SgIfStmt { // For Fortran if then elseif .. elseif ... case // variant == ELSEIF_NODE public: SgIfElseIfStmt(SgExpression &condList, SgStatement &blockList, SgSymbol &constructName); int numberOfConditionals(); // the number of conditionals SgStatement *body(int b); // block b void setBody(int b); // sets block SgExpression *conditional(int i); // the i-th conditional void setConditional(int i); // sets the i-th conditional void addClause(SgExpression &cond, SgStatement &block); void removeClause(int b); // removes block b and it's conditional ~SgIfElseIfStmt(); };
SgIfElseIfStmt
(SgExpression &condList, SgStatement &blockList, SgSymbol &constructName)
SgExpression *conditional
(int i)
void addClause
(SgExpression &cond, SgStatement &block)
Represents the Fortran arithmentic if
statement.
class SgArithIfStmt: public SgStatement { // For Fortran Arithementic if // variant == ARITHIF_NODE public: inline SgArithIfStmt(int variant); inline SgArithIfStmt(SgExpression &cond, SgLabel &llabel, SgLabel &elabel, SgLabel &glabel); inline SgExpression *conditional(); inline void set_conditional(SgExpression &cond); inline SgExpression *label(int i); // the <, ==, and > goto labels. // in order 0->2. inline void setLabel(SgLabel &label); inline ~SgArithIfStmt(); };
SgArithIfStmt
(SgExpression &cond, SgLabel &llabel, SgLabel &elabel, SgLabel &glabel)
void set_conditional
(SgExpression &cond)
SgArithIfStmt
is used in the following example programs:
Represents the Fortran where
statement.
class SgWhereStmt: public SgLogIfStmt { // fortran Where stmt // variant == WHERE_NODE public: inline SgWhereStmt(SgExpression &cond, SgStatement &body); inline ~SgWhereStmt(); };
SgWhereStmt
(SgExpression &cond, SgStatement &body)
Represents the Fortran where .. elsewhere
statement.
class SgWhereBlockStmt: public SgIfStmt { // fortran Where - Elsewhere stmt // variant == WHERE_BLOCK_STMT public: SgWhereBlockStmt(SgExpression &cond, SgStatement &trueBody, SgStatement &falseBody); ~SgWhereBlockStmt(); };
SgWhereBlockStmt
(SgExpression &cond, SgStatement &trueBody, SgStatement &falseBody)
Represents the case option
statement.
class SgCaseOptionStmt: public SgStatement { // Fortran case option statement // variant == CASE_NODE public: inline SgCaseOptionStmt(SgExpression &caseRangeList, SgStatement &body, SgSymbol &constructName); inline SgCaseOptionStmt(SgExpression &caseRangeList, SgStatement *body, SgSymbol &constructName); inline SgCaseOptionStmt(SgExpression &caseRangeList, SgStatement *body, SgSymbol *constructName); inline ~SgCaseOptionStmt(); inline SgExpression *caseRangeList(); inline void setCaseRangeList(SgExpression &caseRangeList); inline SgExpression *caseRange(int i); inline void setCaseRange(SgExpression &caseRange); inline SgStatement *body(); inline void setBody(SgStatement &body); };
SgCaseOptionStmt
(SgExpression &caseRangeList, SgStatement &body, SgSymbol &constructName)
void setCaseRangeList
(SgExpression &caseRangeList)
SgExpression *caseRange
(int i)
void setCaseRange
(int i, SgExpression &caseRange)
void setBody
(SgStatement &body)
All Languages:
C:
Fortran:
Fortran 90:
Represents executable statements, for all languages.
class SgExecutableStatement: public SgStatement { // this is really a non-control, non-declaration stmt. // no special functions here. public: inline SgExecutableStatement(int variant); };
SgExecutableStatement
(int variant)
Represents the continue
statement for all languages.
class SgContinueStmt: public SgExecutableStatement { // variant == CONT_STAT in Fortran and // variant == CONTINUE_NODE in C public: inline SgContinueStmt(); inline ~SgContinueStmt(); };
Represents the end
statements of basic blocks for all languages.
class SgControlEndStmt: public SgExecutableStatement { // the end of a basic block // variant == CONTROL_END public: inline SgControlEndStmt(int variant); inline SgControlEndStmt(); inline ~SgControlEndStmt(); };
NOTE: In C++, SgControlEnd usually corresponds to }
, but
the usage is inconsistent, so one should not count on
SgControlEnd appearing every place where }
appears in the code.
Similarly, SgControlEnd might appear in certain places where
it is not expected. Furthermore, you should be aware that SgControlEnd
is also used to represent an empty class definition as
in: class A{};
. This was done to distinguish such definitions
from forward declarations, as in class A;
.
SgControlEndStmt
is used in the following example programs:
Represents the return
statement for all languages.
class SgReturnStmt: public SgExecutableStatement { // the return (expr) node // variant == RETURN_NODE//RETURN_STAT public: SgReturnStmt(SgExpression &returnValue); SgReturnStmt(); inline SgExpression *returnValue(); inline void setReturnValue(SgExpression &retVal); inline ~SgReturnStmt(); };
SgReturnStmt
(SgExpression &returnValue)
void setReturnValue
(SgExpression &retVal)
SgReturnStmt
is used in the following example programs:
Represents the goto
for all languages.
class SgGotoStmt: public SgExecutableStatement { // the fortran or C goto // variant == GOTO_NODE public: inline SgGotoStmt(SgLabel &label); inline SgLabel *branchLabel(); inline ~SgGotoStmt(); };
SgGotoStmt
is used in the following example programs:
Represents C expression statements.
class SgCExpStmt: public SgExecutableStatement { // C non-control expression Statment // variant == EXPR_STMT_NODE public: inline SgCExpStmt(SgExpression &exp); inline SgCExpStmt(SgExpression &lhs, SgExpression &rhs); inline SgExpression *expr(); // the expression inline void replaceExpression(SgExpression &e); // replace exp with e inline ~SgCExpStmt(); };
SgCExpStmt
(SgExpression &lhs, SgExpression &rhs)
void replaceExpression
(SgExpression &e)
SgCExpStmt
is used in the following example programs:
Represents the C break
statement.
class SgBreakStmt: public SgExecutableStatement { // the end of a basic block // variant == BREAK_NODE public: inline SgBreakStmt(); inline ~SgBreakStmt(); };
Represents Fortran assignment statements.
class SgAssignStmt: public SgExecutableStatement { // Fortran assignment Statment // variant == ASSIGN_STAT public: inline SgAssignStmt(int variant); inline SgAssignStmt(SgExpression &lhs, SgExpression &rhs); inline SgExpression *lhs(); // the left hand side inline SgExpression *rhs(); // the right hand side inline void replaceLhs(SgExpression &e); // replace lhs with e inline void replaceRhs(SgExpression &e); // replace rhs with e };
SgAssignStmt
(SgExpression &lhs, SgExpression &rhs)
void replaceLhs
(SgExpression &e)
void replaceRhs
(SgExpression &e)
SgAssignStmt
is used in the following example programs:
Represents Fortran pointer assignment statements.
class SgPointerAssignStmt: public SgAssignStmt { // Fortran pointer assignment statement // variant == POINTER_ASSIGN_STAT public: inline SgPointerAssignStmt(SgExpression lhs, SgExpression rhs); inline ~SgPointerAssignStmt(); };
SgPointerAssignStmt
(SgExpression lhs, SgExpression rhs)
Represents Fortran allocate and deallocate.
class SgHeapStmt: public SgExecutableStatement { // Fortran heap space allocation and deallocation statements // variant == ALLOCATE_STMT or DEALLOCATE_STMT public: inline SgHeapStmt(int variant, SgExpression &allocationList, SgExpression &statVariable); inline ~SgHeapStmt(); inline SgExpression *allocationList(); inline void setAllocationList(SgExpression &allocationList); inline SgExpression *statVariable(); inline void setStatVariable(SgExpression &statVar); };
SgHeapStmt
(int variant, SgExpression &allocationList, SgExpression &statVariable)
SgExpression *allocationList
()
void setAllocationList
(SgExpression &allocationList)
void setStatVariable
(SgExpression &statVar)
Represents Fortran pointer initialization statement.
class SgNullifyStmt: public SgExecutableStatement { // Fortran pointer initialization statement // variant == NULLIFY_STMT public: inline SgNullifyStmt(SgExpression &objectList); inline ~SgNullifyStmt(); inline SgExpression *nullifyList(); inline void setNullifyList(SgExpression &nullifyList); };
SgNullifyStmt
(SgExpression &objectList)
void setNullifyList
(SgExpression &nullifyList)
Represents Fortran statements containing lists of labels.
class SgLabelListStmt: public SgExecutableStatement { // the fortran // statements containg a list of labels public: SgLabelListStmt(int variant); int numberOfTargets(); SgExpression *labelList(); void setLabelList(SgExpression &labelList); };
void setLabelList
(SgExpression &labelList)
Represents Fortran assigned goto
statement.
class SgAssignedGotoStmt: public SgLabelListStmt { // the fortran // variant == ASSGOTO_NODE public: SgAssignedGotoStmt(SgSymbol &symbol, SgExpression &labelList); SgSymbol *symbol(); void setSymbol(SgSymbol &symb); ~SgAssignedGotoStmt(); };
SgAssignedGotoStmt
(SgSymbol &symbol, SgExpression &labelList)
void setSymbol
(SgSymbol &symb)
SgAssignedGotoStmt
is used in the following example programs:
Represents Fortran computed goto
statement.
class SgComputedGotoStmt: public SgLabelListStmt { // the fortran goto // variant == COMGOTO_NODE public: inline SgComputedGotoStmt(SgExpression &expr, SgLabel &label); inline void addLabel(SgLabel &label); inline SgExpression *exp(); inline void setExp(SgExpression &exp); inline ~SgComputedGotoStmt(); };
SgComputedGotoStmt
(SgExpression &expr, SgLabel &label)
void setExp
(SgExpression &exp)
SgComputedGotoStmt
is used in the following example programs:
Represents the Fortran stop
statement.
class SgStopOrPauseStmt: public SgExecutableStatement { // the fortran stop // variant == STOP_STAT public: SgStopOrPauseStmt(int variant, SgExpression *expr); SgExpression *exp(); void setExp(SgExpression &exp); ~SgStopOrPauseStmt(); };
SgStopOrPauseStmt
(int variant, SgExpression &expr)
void setExp
(SgExpression &exp)
Represents the Fortran call
statement.
class SgCallStmt: public SgExecutableStatement { // the fortran call // variant == PROC_STAT public: SgCallStmt(SgSymbol &name, SgExpression &args); SgCallStmt(SgSymbol &name); SgSymbol *name(); // name of subroutine being called int numberOfArgs(); // the number of arguement expressions void addArg(SgExpression &arg); SgExpression *arg(int i); // the i-th argument expression ~SgCallStmt(); };
SgCallStmt
(SgSymbol &name, SgExpression &args)
void addArg
(SgExpression &arg)
SgCallStmt
is used in the following example programs:
Represents IO statements, for all languages.
class SgIOStmt: public SgExecutableStatement { // fortran input/output and their control statements // abstract class public: inline SgIOStmt(int variant); };
SgIOStmt
is used in the following example programs:
Represents the Fortran read
, write
, and print
statements.
class SgInputOutputStmt: public SgIOStmt { // fortran input and output statements // variant = READ_STAT, WRITE_STATE, PRINT_STAT public: inline SgInputOutputStmt(int variant, SgExpression &specList, SgExpression &itemList); inline SgExpression *specList(); inline void setSpecList(SgExpression &specList); inline SgExpression *itemList(); inline void setItemList(SgExpression &itemList); inline ~SgInputOutputStmt(); };
SgInputOutputStmt
(int variant, SgExpression &specList, SgExpression &itemList)
void setSpecList
(SgExpression &specList)
void setItemList
(SgExpression &itemList)
SgInputOutputStmt
is used in the following example programs:
Represents the Fortran open
, close
, inquire
, backspace
, rewind
, endfile
, and format
statements.
class SgIOControlStmt: public SgExecutableStatement { // fortran input/output control and editing statements // variant = OPEN_STAT, CLOSE_STAT, INQUIRE_STAT, BACKSPACE_STAT, // REWIND_STAT, ENDFILE_STAT, FORMAT_STAT public: SgIOControlStmt(int variant, SgExpression &controlSpecifierList); inline SgExpression *controlSpecList(); inline void setControlSpecList(SgExpression &controlSpecList); inline ~SgIOControlStmt(); };
SgIOControlStmt
(int variant, SgExpression &controlSpecifierList)
SgExpression *controlSpecList
()
void setControlSpecList
(SgExpression &controlSpecList)
SgIOControlStmt
is used in the following example programs:
Represents the Fortran 90 cycle
statements.
class SgCycleStmt: public SgExecutableStatement { // the fortran 90 cycle statement // variant == CYCLE_STMT public: inline SgCycleStmt(SgSymbol &symbol); inline SgSymbol *constructName(); // the name of the loop to cycle inline void setConstructName(SgSymbol &constructName); inline ~SgCycleStmt(); };
void setConstructName
(SgSymbol &constructName)
Represents the Fortran 90 exit
statements.
class SgExitStmt: public SgControlEndStmt { // the fortran 90 exit statement // variant == EXIT_STMT public: inline SgExitStmt(SgSymbol &construct_name); inline ~SgExitStmt(); inline SgSymbol *constructName(); // the name of the loop to cycle inline void setConstructName(SgSymbol &constructName); };
SgExitStmt
(SgSymbol &construct_name)
void setConstructName
(SgSymbol &constructName)