| Introduction | Projects and Files | Statements | Expressions | Symbols | Types |
| Attributes | Labels | Non-Member Functions | Constructing Declarations | Example Programs | Index |
Many statements contain expressions. SgExpression is the
base class for all expressions. Unlike the SgStatement class
hierarchy, there is not a subclass for every expression operator type.
Basic binary operators such as the standard arithmetic operators are
identified only the integer variant returned by the SgExpression
member function variant(). The expression nodes that have
their own subclass do so because they have a special type of
constructor or special fields.
All Languages:
C:
C++:
Fortran:
Fortran 90:
SgExpression is the base class for all the other expression classes.
Every expression may have up to two operands (or subexpressions), the
left hand side lhs() and the right hand side rhs().
Each expression has a type type(), may have a symbol
symbol(), and has a unique identifier id().
class SgExpression {
public:
PTR_LLND thellnd;
// generic expression class.
SgExpression(int variant, SgExpression &lhs, SgExpression &rhs,
SgSymbol &s, SgType &type);
SgExpression(int variant, SgExpression *lhs, SgExpression *rhs,
SgSymbol *s, SgType *type);
SgExpression(int variant, SgExpression *lhs, SgExpression *rhs,
SgSymbol *s);
// for some node in fortran
SgExpression(int variant,char *str);
SgExpression(int variant);
SgExpression(PTR_LLND ll);
inline SgExpression(SgExpression &);
inline ~SgExpression();
inline SgExpression *lhs();
inline SgExpression *rhs();
SgExpression *operand(int i); //i=0,1
inline int variant();
inline SgType *type();
SgSymbol *symbol();
inline int id();
inline SgExpression *nextInExprTable();
inline void setLhs(SgExpression &e);
inline void setLhs(SgExpression *e);
inline void setRhs(SgExpression &e);
inline void setRhs(SgExpression *e);
inline void setSymbol(SgSymbol &s);
inline void setSymbol(SgSymbol *s);
inline void setType(SgType &t);
inline void setType(SgType *t);
inline void setVariant(int v);
inline SgExpression ©();
inline SgExpression *copyPtr();
inline char *unparse();
void sunparse(char *buffer);
inline void unparsestdout();
inline SgExpression *IsSymbolInExpression(SgSymbol &symbol);
inline void replaceSymbolByExpression(SgSymbol &symbol, SgExpression &expr);
inline SgExpression *symbRefs();
inline SgExpression *arrayRefs();
int linearRepresentation(int *coeff, SgSymbol **symb,int *cst, int size);
SgExpression *normalForm(int n, SgSymbol *s);
SgExpression *coefficient(SgSymbol &s);
int isInteger();
int valueInteger();
friend SgExpression &operator + ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator - ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator * ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator / ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator % ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator ^ ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator <<( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator >>( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator < ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator > ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator <= ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator >= ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator & ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator | ( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator &&( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator ||( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator +=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator &=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator *=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator /=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator %=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator ^=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator <<=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &operator >>=( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgAssignOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgEqOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgNeqOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgExprListOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgRecRefOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgPointStOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgScopeOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgDDotOp( SgExpression &lhs, SgExpression &rhs);
friend SgExpression &SgBitNumbOp( SgExpression &lhs, SgExpression &rhs);
/////////////// 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);
};
Note that SgExpression is used to represent the basic binary operators,
for C and Fortran, which are listed below along with their variants: + ADD_OP - SUBT_OP * MULT_OP / DIV_OP % MOD_OP< LT_OP > GT_OP <= LE_OP >= GE_OP
^ XOR_OP bitwise exclusive-OR in C++, .XOR. in Fortran & BITAND_OP | BITOR_OP && AND_OP || OR_OP << LSHIFT_OP >> RSHIFT_OP
= ASSGN_OP += PLUS_ASSGN_OP &= AND_ASSGN_OP *= MULT_ASSGN_OP /= DIV_ASSGN_OP %= MOD_ASSGN_OP ^= XOR_ASSGN_OP <<= LSHIFT_ASSGN_OP >>= RSHIFT_ASSGN_OP
== EQ_OP != NE_OP
-> POINTST_OP :: SCOPE_OP : BIT_NUMBER in C++, for bit fields
SgExpression(int variant, SgExpression &lhs, SgExpression &rhs, SgSymbol &s, SgType &type)
i = 0, 1. In Sage++ versions 1.7 and earlier
i = 1, 2. Starting with Sage++ version 1.9 all arguments that play
the role of indices start with zero.
SgExpression *nextInExprTable()
SgExpression *IsSymbolInExpression(SgSymbol &symbol)
void replaceSymbolByExpression(SgSymbol &symbol, SgExpression &expr)
int linearRepresentation(int *coeff, SgSymbol **symb,int *cst, int size)
SgExpression *normalForm(int n, SgSymbol *s)
s.
SgExpression *coefficient(SgSymbol &s)
s in the expression.
isInteger() is true, returns the integer value the
expression can be reduced to.
The standard binary operators do not have explicit subclasses or constructors. However, each of these operators has been overloaded as ``friends'' of the SgExpression class, so building expressions with these operators is a very simple task. For example, to build an expression of the form
(X+3)*Y+6.4
the program only needs two symbols and two value expressions:
SgVariableSymb xsymb("X"), ysymb("Y");
SgVarRefExp x(xsymb), y(ysymb);
SgValueExp three(3), fltvalue(6.4);
SgExpression &e = (x + three)*y + fltvalue;
The variables X and Y are first created as symbols,
and then expressions that are references to the symbols are created
as SgVarRefExp objects.
Notice that we have not given types to the variables X and Y and
declarations for X and Y have not yet been generated.
In this code, e is now a reference to the root (+) of
the parse tree for the desired expression. Note that the constructors
for the SgValueExp class allow any type of literal to be created.
A few standard operators have not been overloaded because this would
create confusion with standard C++ operations. These include =,
==, !=, ->, and ::.
They are constructed by the functions,
SgExpression SgAssignOp( SgExpression &lhs, SgExpression &rhs);
SgExpression SgEqOp( SgExpression &lhs, SgExpression &rhs);
SgExpression SgNeqOp( SgExpression &lhs, SgExpression &rhs);
SgExpression SgPointStOp( SgExpression &lhs, SgExpression &rhs);
SgExpression SgScopeOp( SgExpression &lhs, SgExpression &rhs);
Therefore, to build a C assignment statement of the form
X = (X+3)*Y+6.4
using the definitions for variables X, Y, three
and fltvalue given above, we write
SgCExpStmt c_stmt(SgAssignOp(x.copy(), (x + three)*y + fltvalue));
In the case of Fortran note that the assignment is a statement and not an expression. To build the same statement in Fortran we write
SgAssignStmt fortran_stmt(x.copy(), (x + three)*y + fltvalue);
The subclasses are all designed to provide handy constructors so that it is easy to build expressions and extract values. 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.
SgExpression is used in the following example programs:
Represents literals, for all languages.
class SgValueExp: public SgExpression {
// a value of one of the base types
// integers: INT_VAL
// characters: CHAR_VAL
// floating point numbers: FLOAT_VAL
// double precision floating point numbers: DOUBLE_VAL
// strings: STRING_VAL
// complex numbers: COMPLEX_VAL
// long double numbers: LONG_DOUBLE_VAL
// long integers: LONG_INT_VAL
// unsigned integers: UNSIGNED_INT_VAL
// unsigned long integers: UNSIGNED_LONG_INT_VAL
public:
inline SgValueExp(int value);
SgValueExp(unsigned int val); // makes 10u, for example
SgValueExp(long int val); // makes 10l, for example
SgValueExp(long unsigned int val); //makes 10ul, for example
inline SgValueExp(char char_val);
inline SgValueExp(float float_val); // makes 10.0f, for example
inline SgValueExp(double double_val); // makes 10.0, for example
inline SgValueExp(char *string_val);
SgValueExp(long double val); // makes 10.0l, for example
SgValueExp(int variant, char *value_string);
// variant = FLOAT_VAL, DOUBLE_VAL, LONG_DOUBLE_VAL
inline SgValueExp(double real, double imaginary);
inline SgValueExp(SgValueExp &real, SgValueExp &imaginary);
inline void setValue(int int_val);
inline void setValue(char char_val);
inline void setValue(float float_val);
inline void setValue(double double_val);
inline void setValue(char *string_val);
inline void setValue(double real, double im);
inline void setValue(SgValueExp &real, SgValueExp & im);
inline int intValue();
inline char* floatValue();
inline char charValue();
inline char* doubleValue();
inline char * stringValue();
inline SgExpression *realValue();
inline SgExpression *imaginaryValue();
};
SgValueExp(unsigned int value)
SgValueExp(long unsigned int value)
inline SgValueExp(char char_val)
inline SgValueExp(float float_val)
inline SgValueExp(double double_val)
inline SgValueExp(char *string_val)
SgValueExp(int variant, char *value_string)
FLOAT_VAL, DOUBLE_VAL,
and LONG_DOUBLE_VAL.
inline SgValueExp(double real, double imaginary)
inline SgValueExp(SgValueExp &real, SgValueExp &imaginary)
inline void setValue(int int_val)
inline void setValue(char char_val)
inline void setValue(float float_val)
inline void setValue(double double_val)
inline void setValue(char *string_val)
inline void setValue(double real, double im)
inline void setValue(SgValueExp &real, SgValueExp & im)
inline SgExpression *realValue()
inline SgExpression *imaginaryValue()
SgValueExp is used in the following example programs:
Represents function references, for all languages.
class SgFunctionRefExp: public {SgExpression} {
// function_name(formal args) - for function headers and protytpes.
// variant = FUNCTION_REF
public:
inline SgFunctionRefExp(PTR_LLND ll);
inline SgFunctionRefExp(SgSymbol &fun);
inline ~SgFunctionRefExp();
inline SgSymbol *funName();
inline SgExpression *args();
inline int numberOfArgs();
inline SgExpression *arg(int i);
SgExpression * AddArg(char *, SgType &);
}
inline SgFunctionRefExp(PTR_LLND ll)
inline SgFunctionRefExp(SgSymbol &fun)
inline SgExpression *arg(int i)
SgExpression *AddArg(char *, SgType &)
Represents function calls, for all languages.
class SgFunctionCallExp: public {SgExpression} {
// function_name(expr1, expr2, ....)
// variant == FUNC_CALL
public:
inline SgFunctionCallExp(PTR_LLND ll);
inline SgFunctionCallExp(SgSymbol &fun, SgExpression ¶mList);
inline SgFunctionCallExp(SgSymbol &fun);
inline ~SgFunctionCallExp();
inline SgSymbol *funName();
inline SgExpression *args();
inline int numberOfArgs();
inline SgExpression *arg(int i);
inline void addArg(SgExpression &arg);
};
inline SgFunctionCallExp(PTR_LLND ll)
inline SgFunctionCallExp(SgSymbol &fun, SgExpression ¶mList)
inline SgFunctionCallExp(SgSymbol &fun)
void addArg(SgExpression &arg)
SgFunctionCallExp is used in the following example programs:
Represents lists of expressions, for all languages.
class SgExprListExp: public SgExpression {
// variant == EXPR_LIST
public:
inline SgExprListExp(PTR_LLND ll);
inline SgExprListExp();
inline SgExprListExp(SgExpression &ptr);
inline ~SgExprListExp();
inline int length();
inline SgExpression *elem(int i);
inline SgExprListExp *next();
inline SgExpression *value();
inline void setValue(SgExpression &ptr);
inline void append(SgExpression &arg); //arg is a single element
// this is equiv. to (append this (list arg)) in Scheme
//use to add arg as the last element to the list
void linkToEnd(SgExpression &arg); //arg should be a list
// i.e., have type SgExprListExp
//this works like append in Scheme
//use to append arg as a list at the end of the given list
//i.e, build a list consisting of the elements of the given
//list followed by the elements of the arg list
//if arg is not a list this produces a dotted pair
};
SgExprListExp(SgExpression &ptr)
void setValue(SgExpression &ptr)
void append(SgExpression &arg)
arg is a single element. This is equivalent to
(append this (list arg)) in Scheme. Use this method to add
arg as the last element to the list.
void linkToEnd(SgExpression &arg)
arg should be a list, i.e., it should have type SgExprListExp.
This method works like append in Scheme. Use it to append arg as a
list at the end of the given list, i.e, build a list consisting of the
elements of the given list, followed by the elements of the arg list.
If arg is not a list this produces a dotted pair.
SgExprListExp is used in the following example programs:
Represents scalar variable references and non-indexed array references, for all languages.
class SgVarRefExp: public SgExpression {
// scalar variable reference or non-indexed array reference
// variant == VAR_REF
public:
inline SgVarRefExp (PTR_LLND ll);
inline SgVarRefExp(SgSymbol &s);
inline SgVarRefExp(SgSymbol *s);
SgExpression *progatedValue(); // if scalar propogation worked
inline ~SgVarRefExp();
};
SgVarRefExp is used in the following example programs:
Represents array references, for all languages.
class SgArrayRefExp: public SgExpression {
// an array reference
// variant == ARRAY_REF
public:
inline SgArrayRefExp(PTR_LLND ll);
inline SgArrayRefExp(SgSymbol &s);
inline SgArrayRefExp(SgSymbol &s, SgExpression &subscripts);
inline SgArrayRefExp(SgSymbol &s, SgExpression &sub1,SgExpression &sub2);
inline SgArrayRefExp(SgSymbol &s, SgExpression &sub1,SgExpression &sub2,
SgExpression &sub3);
inline SgArrayRefExp(SgSymbol &s, SgExpression &sub1,SgExpression &sub2,
SgExpression &sub3,SgExpression &sub4);
inline ~SgArrayRefExp();
inline int numberOfSubscripts(); // the number of subscripts in reference
inline SgExpression *subscripts();
inline SgExpression *subscript(int i);
inline void addSubscript(SgExpression &e);
inline void setSymbol(SgSymbol &s);
};
SgArrayRefExp(SgSymbol &s, SgExpression &subscripts)
SgArrayRefExp(SgSymbol &s, SgExpression &sub1,SgExpression &sub2)
SgArrayRefExp(SgSymbol &s, SgExpression &sub1,SgExpression &sub2,SgExpression &sub3)
SgArrayRefExp(SgSymbol &s, SgExpression &sub1,SgExpression &sub2,SgExpression &sub3,SgExpression &sub4)
SgExpression *subscript(int i)
void addSubscript(SgExpression &e)
SgArrayRefExp is used in the following example programs:
Represents initializations of the form {expr1,expr2,expr3}, for all languages.
class SgInitListExp: public SgExpression {
// used for initializations. form: { expr1,expr2,expr3}
// variant == INIT_LIST
public:
inline SgInitListExp(PTR_LLND ll);
inline SgInitListExp(SgExpression &expr_list);
inline SgInitListExp(int n, SgExpression *components);
inline ~SgInitListExp();
inline SgExpression *arg(int i); // the i-th term
int numberOfArgs();
inline void setArg(int i, SgExpression &e);
};
SgInitListExp(SgExpression &expr_list)
SgInitListExp(int n, SgExpression *components)
void setArg(int i, SgExpression &e)
Represents C references of fields in structures.
class SgRecordRefExp: public SgExpression {
// a field reference of a structure
// variant == RECORD_REF
public:
inline SgRecordRefExp(PTR_LLND ll);
inline SgRecordRefExp(SgSymbol &recordName, char *fieldName);
inline SgRecordRefExp(SgExpression &recordExp, char *fieldName);
inline ~SgRecordRefExp();
inline SgSymbol *fieldName();
inline SgSymbol *recordName();
inline SgExpression *record();
};
SgRecordRefExp(SgSymbol &recordName, char *fieldName)
SgRecordRefExp(SgExpression &recordExp, char *fieldName)
Represents C pointers used as arrays.
class SgPntrArrRefExp: public SgExpression {
public:
inline SgPntrArrRefExp(PTR_LLND ll);
inline SgPntrArrRefExp(SgExpression &p);
inline SgPntrArrRefExp(SgExpression &p, SgExpression &subscripts);
inline SgPntrArrRefExp(SgExpression &p, int n, SgExpression &sub1,
SgExpression &sub2);
inline SgPntrArrRefExp(SgExpression &p, int n, SgExpression &sub1,
SgExpression &sub2, SgExpression &sub3);
inline SgPntrArrRefExp(SgExpression &p, int n, SgExpression &sub1,
SgExpression &sub2, SgExpression &sub3,
SgExpression &sub4);
inline ~SgPntrArrRefExp();
inline int dimension(); // the number of subscripts in reference
inline SgExpression *subscript(int i);
inline void addSubscript(SgExpression &e);
inline void setPointer(SgExpression &p);
};
SgPntrArrRefExp(SgExpression &p)
SgPntrArrRefExp(SgExpression &p, SgExpression &subscripts)
SgPntrArrRefExp(SgExpression &p, int n, SgExpression &sub1, SgExpression &sub2)
SgPntrArrRefExp(SgExpression &p, int n, SgExpression &sub1, SgExpression &sub2, SgExpression &sub3)
SgPntrArrRefExp(SgExpression &p, int n, SgExpression &sub1, SgExpression &sub2, SgExpression &sub3, SgExpression &sub4)
SgExpression *subscript(int i)
void addSubscript(SgExpression &e)
void setPointer(SgExpression &p)
Represents C pointer dereferences.
class SgPointerDerefExp: public SgExpression {
// pointer dereferencing
// variant == DEREF_OP
public:
inline SgPointerDerefExp(PTR_LLND ll);
inline SgPointerDerefExp(SgExpression &pointerExp);
inline ~SgPointerDerefExp();
inline SgExpression *pointerExp();
};
SgPointerDerefExp(PTR_LLND ll)
SgPointerDerefExp(SgExpression &pointerExp)
Represents C uses of pointers to functions.
class SgFuncPntrExp: public SgExpression {
// (functionpointer)(expr1,expr2,expr3)
// variant == FUNCTION_OP
public:
inline SgFuncPntrExp(PTR_LLND ll);
inline SgFuncPntrExp(SgExpression &ptr);
inline ~SgFuncPntrExp();
inline SgExpression *funExp();
inline void setFunExp(SgExpression &s);
inline int numberOfArgs();
inline SgExpression *arg(int i);
inline void addArg(SgExpression &arg); // add an argument.
SgExpression* AddArg(SgSymbol *thefunc, char *name, SgType &);
// add a formal parameter
// to a pointer to a function prototype or parameter.
// this returns the expression
};
SgFuncPntrExp(SgExpression &ptr)
void setFunExp(SgExpression &s)
void addArg(SgExpression &arg)
SgExpression AddArg(SgSymbol *thefunc, char *name, SgType &)
Represents extended C and Fortran 90 array references of the form low:up:stride
class SgSubscriptExp: public SgExpression {
// Fortran 90 vector subscript expression
// variant == DDOT
public:
inline SgSubscriptExp(PTR_LLND ll);
inline SgSubscriptExp(SgExpression &lbound, SgExpression &ubound,
SgExpression &step);
inline SgSubscriptExp(SgExpression &lbound, SgExpression &ubound);
inline ~SgSubscriptExp();
// perhaps this function can use LlndMapping
SgExpression *lbound();
SgExpression *ubound();
SgExpression *step();
};
SgSubscriptExp(SgExpression &lbound, SgExpression &ubound, SgExpression &step)
SgSubscriptExp(SgExpression &lbound, SgExpression &ubound)
To build a fortran 90 array reference X(1:100:3, i+3) or
the ``extended'' C array reference X[1:100:3][i+3] we can write
SgVariableSymb xsymb("X"), isymb("i");
SgVarRefExp i(isymb);
SgValueExp three(3), one(1), hunderd(100);
SgSubscriptExp range(one, hundred, three);
SgArrayRefExp(xsymb, range, i+three.copy());
Represents unary expressions, for all languages. There is a set of non-member functions that can be used to construct instances of the SgUnaryExp class corresponding to different variants. See the chapter Non-Member Functions, section Unary Functions for a description of these functions.
class SgUnaryExp: public SgExpression {
public:
inline SgUnaryExp(PTR_LLND ll);
inline SgUnaryExp(int variant, SgExpression & e);
inline SgUnaryExp(int variant, int post, SgExpression & e);
inline int post();
SgExpression &operand();
};
SgUnaryExp(int variant, SgExpression & e)
SgUnaryExp(int variant, int post, SgExpression & e)
class SgCastExp: public SgExpression {
public:
inline SgCastExp(PTR_LLND ll);
inline SgCastExp(SgType &t, SgExpression &e);
inline SgCastExp(SgType &t);
inline ~SgCastExp();
};
SgCastExp(SgType &t, SgExpression &e)
Represents the C conditional expression operator ? : .
class SgExprIfExp: public SgExpression {
// (expr1)? expr2 : expr3
// variant == EXPR_IF
public:
inline SgExprIfExp(PTR_LLND ll);
inline SgExprIfExp(SgExpression &exp1,SgExpression &exp2, SgExpression &exp3);
SgExpression &conditional();
SgExpression &trueExp();
SgExpression &falseExp();
inline void setConditional(SgExpression &c);
void setTrueExp(SgExpression &t);
void setFalseExp(SgExpression &f);
~SgExprIfExp();
};
SgExprIfExp(SgExpression &exp1,SgExpression &exp2, SgExpression &exp3)
void setConditional(SgExpression &c)
void setTrueExp(SgExpression &t)
void setFalseExp(SgExpression &f)
class SgDeleteExp: public SgExpression {
// delete [size] expr
// variant == DELETE_OP
public:
inline SgDeleteExp(PTR_LLND ll);
inline SgDeleteExp(SgExpression &size, SgExpression &expr);
inline SgDeleteExp(SgExpression &expr);
inline ~SgDeleteExp();
};
SgDeleteExp(SgExpression &size, SgExpression &expr)
SgDeleteExp(SgExpression &expr)
Represents the C++ new statement.
class SgNewExp: public SgExpression {
// new typename
// new typename (expr)
// variant == NEW_OP
public:
inline SgNewExp(PTR_LLND ll);
inline SgNewExp(SgType &t);
inline SgNewExp(SgType &t, SgExpression &e);
~SgNewExp();
};
SgNewExp(SgType &t, SgExpression &e)
Represents the C++ this statement.
class SgThisExp: public SgExpression {
// variant == THIS_NODE
public:
inline SgThisExp (PTR_LLND ll);
inline SgThisExp(SgType &t);
inline ~SgThisExp();
};
Represents Fortran keyword values in I/O statements etc..
class SgKeywordValExp: public SgExpression {
public:
inline SgKeywordValExp(char *name);
inline char *value();
};
Represents Fortran const references, type references, and interface references.
class SgRefExp: public SgExpression {
// Fortran name references
// variant == CONST_REF, TYPE_REF, INTERFACE_REF
public:
inline SgRefExp(PTR_LLND ll);
inline SgRefExp(int variant, SgSymbol &s);
inline ~SgRefExp();
};
SgRefExp(int variant, SgSymbol &s)
Represents Fortran vector constants of the form [expr1,expr2,expr3].
class SgVecConstExp: public SgExpression {
// a vector constant of the form: [ expr1, expr2, expr3]
// variant == VECTOR_CONST
public:
inline SgVecConstExp(PTR_LLND ll);
inline SgVecConstExp(SgExpression &expr_list);
inline SgVecConstExp(int n, SgExpression *components);
inline ~SgVecConstExp();
inline SgExpression *arg(int i); // the i-th term
inline int numberOfArgs();
inline void setArg(int i, SgExpression &e);
};
SgVecConstExp(SgExpression &expr_list)
SgVecConstExp(int n, SgExpression *components)
void setArg(int i, SgExpression &e)
Represents the Fortran equivalence, namelist, and common statements.
class SgObjectListExp: public SgExpression {
// used for EQUIVALENCE, NAMELIST and COMMON statements
// variant == EQUI_LIST, NAMELIST_LIST, COMM_LIST
public:
inline SgObjectListExp(PTR_LLND ll);
inline SgObjectListExp(int variant, SgSymbol &object, SgExpression &list);
inline SgObjectListExp(int variant,SgExpression &objectRef, SgExpression &list);
inline ~SgObjectListExp();
inline SgSymbol *object();
inline SgExpression *objectRef();
inline int listLength();
inline SgSymbol *symbol(int i); //i'th symbol
inline SgExpression *objectRef(int i); //i'th symbol
};
SgObjectListExp(int variant, SgSymbol &object, SgExpression &list)
SgObjectListExp(int variant,SgExpression &objectRef, SgExpression &list)
SgExpression *objectRef(int i)
Represents Fortran default control arguments to I/O statements.
class SgSpecPairExp: public SgExpression {
// Fortran default control arguments to Input/Output statements
// variant == SPEC_PAIR
public:
inline SgSpecPairExp(PTR_LLND ll);
inline SgSpecPairExp(SgExpression &arg, SgExpression &value);
inline SgSpecPairExp(SgExpression &arg);
inline SgSpecPairExp(char *arg, char *value);
inline ~SgSpecPairExp();
inline SgExpression *arg();
inline SgExpression *value();
};
SgSpecPairExp(SgExpression &arg, SgExpression &value)
SgSpecPairExp(SgExpression &arg)
SgSpecPairExp(char *arg, char *value)
Represents Fortran index variable bound instantiations and do loop range representation.
class SgIOAccessExp: public SgExpression {
// Fortran index variable bound instantiation
// variant == IOACCESS
//used for do-loop range representation also.
// this form needs to be standardized.
public:
inline SgIOAccessExp(PTR_LLND ll);
// type-checking on bounds needs to be done.
// Float values are legal in some cases. check manual.
inline SgIOAccessExp(SgSymbol &s, SgExpression lbound,
SgExpression ubound, SgExpression step);
inline SgIOAccessExp(SgSymbol &s, SgExpression lbound,
SgExpression ubound);
inline ~SgIOAccessExp();
};
SgIOAccessExp(SgSymbol &s, SgExpression lbound, SgExpression ubound, SgExpression step)
SgIOAccessExp(SgSymbol &s, SgExpression lbound, SgExpression ubound)
Represents Fortran index variable bound instantiations.
class SgImplicitTypeExp: public SgExpression {
// Fortran index variable bound instantiation
// variant == IMPL_TYPE
public:
inline SgImplicitTypeExp(PTR_LLND ll);
inline SgImplicitTypeExp(SgType &type, SgExpression &rangeList);
inline ~SgImplicitTypeExp();
inline SgType *type();
inline SgExpression *rangeList();
inline char *alphabeticRange();
};
SgImplicitTypeExp(PTR_LLND ll)
SgImplicitTypeExp(SgType &type, SgExpression &rangeList)
Represents Fortran type expressions.
class SgTypeExp: public SgExpression {
// Fortran type expression
// variant == TYPE_OP
public:
inline SgTypeExp(PTR_LLND ll);
inline SgTypeExp(SgType &type);
inline ~SgTypeExp();
inline SgType *type();
};
Represents Fortran seq expressions.
class SgSeqExp: public SgExpression {
// Fortran index variable bound instantiation
// variant == SEQ
public:
inline SgSeqExp(PTR_LLND ll);
inline SgSeqExp(SgExpression &exp1, SgExpression &exp2);
inline ~SgSeqExp();
inline SgExpression *front();
inline SgExpression *rear();
};
SgSeqExp(SgExpression &exp1, SgExpression &exp2)
Represents Fortran string length expressions.
class SgStringLengthExp: public SgExpression {
// Fortran index variable bound instantiation
// variant == LEN_OP
public:
inline SgStringLengthExp(PTR_LLND ll);
inline SgStringLengthExp(SgExpression &length);
inline ~SgStringLengthExp();
inline SgExpression *length();
};
SgStringLengthExp(PTR_LLND ll)
SgStringLengthExp(SgExpression &length)
class SgDefaultExp: public SgExpression {
// Fortran default node
// variant == DEFAULT
public:
SgDefaultExp(PTR_LLND ll);
SgDefaultExp();
~SgDefaultExp();
};
Represents Fortran label references.
class SgLabelRefExp: public SgExpression {
// Fortran label reference
// variant == LABEL_REF
public:
inline SgLabelRefExp(PTR_LLND ll);
inline SgLabelRefExp(SgLabel &label);
inline ~SgLabelRefExp();
inline SgLabel *label();
};
Represents Fortran 90 array constructors.
class SgConstExp: public SgExpression {
public:
inline SgConstExp(PTR_LLND ll);
inline SgConstExp(SgExpression &values);
inline ~SgConstExp();
inline int numberOfArgs();
inline SgExpression *arg(int i);
};
SgConstExp(SgExpression &values)
Represents Fortran 90 structure constructors.
class SgStructConstExp: public SgExpression {
// Fortran 90 structure constructor
// variant == STRUCTURE_CONSTRUCTOR
public:
inline SgStructConstExp(PTR_LLND ll);
// further checks on values need to be done.
inline SgStructConstExp(SgSymbol &structName, SgExpression &values);
inline SgStructConstExp(SgExpression &typeRef, SgExpression &values);
inline ~SgStructConstExp();
inline int numberOfArgs();
inline SgExpression *arg(int i);
};
SgStructConstExp(SgSymbol &structName, SgExpression &values)
SgStructConstExp(SgExpression &typeRef, SgExpression &values)
Represents Fortran 90 attributes.
class SgAttributeExp: public SgExpression {
// Fortran 90 attributes
// variant == PARAMETER_OP, PUBLIC_OP, PRIVATE_OP, ALLOCATABLE_OP,
// DIMENSION_OP, EXTERNAL_OP, IN_OP, OUT_OP, INOUT_OP, INTRINSIC_OP,
// POINTER_OP, OPTIONAL_OP, SAVE_OP, TARGET_OP
public:
inline SgAttributeExp(PTR_LLND ll);
inline SgAttributeExp(int variant);
inline ~SgAttributeExp();
};
Represents Fortran 90 keyword arguments.
class SgKeywordArgExp: public SgExpression {
// Fortran 90 keyword argument
// variant == KEYWORD_ARG
public:
inline SgKeywordArgExp(PTR_LLND ll);
inline SgKeywordArgExp(char *argName, SgExpression &exp);
inline ~SgKeywordArgExp();
inline SgSymbol *arg();
inline SgExpression *value();
};
SgKeywordArgExp(char *argName, SgExpression &exp)
Represents the Fortran 90 ONLY attribute of USE statements.
class SgUseOnlyExp: public SgExpression {
// Fortran 90 USE statement ONLY attribute
// variant == ONLY_NODE
public:
inline SgUseOnlyExp(PTR_LLND ll);
inline SgUseOnlyExp(SgExpression &onlyList);
inline ~SgUseOnlyExp();
inline SgExpression *onlyList();
};
SgUseOnlyExp(SgExpression &onlyList)
Represents the Fortran 90 USE statement renamings.
class SgUseRenameExp: public SgExpression {
// Fortran 90 USE statement renaming
// variant == RENAME_NODE
public:
inline SgUseRenameExp(PTR_LLND ll);
inline SgUseRenameExp(SgSymbol &newName, SgSymbol &oldName);
inline ~SgUseRenameExp();
inline SgSymbol *newName();
inline SgSymbol *oldName();
inline SgExpression *newNameExp();
inline SgExpression *oldNameExp();
};
SgUseRenameExp(SgSymbol &newName, SgSymbol &oldName)