Introduction Projects and Files Statements Expressions Symbols Types
Attributes Labels Non-Member Functions Constructing Declarations Example Programs Index

Expressions

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.


SgExpression

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 &copy(); 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

Member Functions

SgExpression(int variant, SgExpression &lhs, SgExpression &rhs, SgSymbol &s, SgType &type)

SgExpression(int variant)

SgExpression(PTR_LLND ll)

SgExpression *lhs()

SgExpression *rhs()

SgExpression *operand(int i)

int variant()

SgType *type()

SgSymbol *symbol()

int id()

SgExpression *nextInExprTable()

void setLhs(SgExpression &e)

void setRhs(SgExpression &e)

void setSymbol(SgSymbol &s)

void setType(SgType &t)

void setVariant(int v)

SgExpression &copy()

char *unparse()

void sunparse(char *buffer)

void unparsestdout()

SgExpression *IsSymbolInExpression(SgSymbol &symbol)

void replaceSymbolByExpression(SgSymbol &symbol, SgExpression &expr)

SgExpression *symbRefs()

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()

SgExpression Usage

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.

Example Programs

SgExpression is used in the following example programs:


SgValueExp

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(); };

Member Functions

inline SgValueExp(int value)

SgValueExp(unsigned int value)

SgValueExp(long 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(long double val)

SgValueExp(int variant, char *value_string)

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()

Example Programs

SgValueExp is used in the following example programs:


SgFunctionRefExp

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 &);
}

Member Functions

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 &)


SgFunctionCallExp

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);
};

Member Functions

inline SgFunctionCallExp(PTR_LLND ll)

inline SgFunctionCallExp(SgSymbol &fun, SgExpression ¶mList)

inline SgFunctionCallExp(SgSymbol &fun)

SgSymbol *funName()

SgExpression *args()

int numberOfArgs()

SgExpression *arg(int i)

void addArg(SgExpression &arg)

Example Programs

SgFunctionCallExp is used in the following example programs:


SgExprListExp

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
};

Member Functions

SgExprListExp(PTR_LLND ll)

SgExprListExp()

SgExprListExp(SgExpression &ptr)

int length()

SgExpression *elem(int i)

SgExprListExp *next()

SgExpression *value()

void setValue(SgExpression &ptr)

void append(SgExpression &arg)

void linkToEnd(SgExpression &arg)

Example Programs

SgExprListExp is used in the following example programs:


SgVarRefExp

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();
};

Member Functions

SgVarRefExp(PTR_LLND ll)

SgVarRefExp(SgSymbol &s)

SgVarRefExp(SgSymbol *s)

SgExpression *progatedValue()

Example Programs

SgVarRefExp is used in the following example programs:


SgArrayRefExp

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);
};

Member Functions

SgArrayRefExp(PTR_LLND ll)

SgArrayRefExp(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)

int numberOfSubscripts()

SgExpression *subscripts()

SgExpression *subscript(int i)

void addSubscript(SgExpression &e)

void setSymbol(SgSymbol &s)

Example Programs

SgArrayRefExp is used in the following example programs:


SgInitListExp

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);
};

Member Functions

SgInitListExp(PTR_LLND ll)

SgInitListExp(SgExpression &expr_list)

SgInitListExp(int n, SgExpression *components)

SgExpression *arg(int i)

int numberOfArgs()

void setArg(int i, SgExpression &e)


SgRecordRefExp

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();
};

Member Functions

SgRecordRefExp(PTR_LLND ll)

SgRecordRefExp(SgSymbol &recordName, char *fieldName)

SgRecordRefExp(SgExpression &recordExp, char *fieldName)

SgSymbol *fieldName()

SgSymbol *recordName()

SgExpression *record()


SgPntrArrRefExp

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);
};

Member Functions

SgPntrArrRefExp(PTR_LLND ll)

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)

int dimension()

SgExpression *subscript(int i)

void addSubscript(SgExpression &e)

void setPointer(SgExpression &p)


SgPointerDerefExp

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();
};

Member Functions

SgPointerDerefExp(PTR_LLND ll)

SgPointerDerefExp(SgExpression &pointerExp)

SgExpression *pointerExp()


SgFuncPntrExp

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
};

Member Functions

SgFuncPntrExp(PTR_LLND ll)

SgFuncPntrExp(SgExpression &ptr)

SgExpression *funExp()

void setFunExp(SgExpression &s)

int numberOfArgs()

SgExpression *arg(int i)

void addArg(SgExpression &arg)

SgExpression AddArg(SgSymbol *thefunc, char *name, SgType &)


SgSubscriptExp

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();
};

Member Functions

SgSubscriptExp(PTR_LLND ll)

SgSubscriptExp(SgExpression &lbound, SgExpression &ubound, SgExpression &step)

SgSubscriptExp(SgExpression &lbound, SgExpression &ubound)

SgExpression *lbound()

SgExpression *ubound()

SgExpression *step()

SgSubscriptExp Usage

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());


SgUnaryExp

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();
};

Member Functions

SgUnaryExp(PTR_LLND ll)

SgUnaryExp(int variant, SgExpression & e)

SgUnaryExp(int variant, int post, SgExpression & e)

int post()

SgExpression &operand()


SgCastExp

Represents C casts.

class  SgCastExp: public SgExpression {
public:
  inline SgCastExp(PTR_LLND ll);
  inline SgCastExp(SgType &t, SgExpression &e);
  inline SgCastExp(SgType &t);
  inline ~SgCastExp();
};

Member Functions

SgCastExp(PTR_LLND ll)

SgCastExp(SgType &t, SgExpression &e)

SgCastExp(SgType &t)


SgExprIfExp

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();
};

Member Functions

SgExprIfExp(PTR_LLND ll)

SgExprIfExp(SgExpression &exp1,SgExpression &exp2, SgExpression &exp3)

SgExpression &conditional()

SgExpression &trueExp()

SgExpression &falseExp()

void setConditional(SgExpression &c)

void setTrueExp(SgExpression &t)

void setFalseExp(SgExpression &f)


SgDeleteExp

Represents C++ delete.

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();
};

Member Functions

SgDeleteExp(PTR_LLND ll)

SgDeleteExp(SgExpression &size, SgExpression &expr)

SgDeleteExp(SgExpression &expr)


SgNewExp

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();
};

Member Functions

SgNewExp(PTR_LLND ll)

SgNewExp(SgType &t)

SgNewExp(SgType &t, SgExpression &e)

SgExpression &numberOfArgs()

SgExpression &argument(int i)


SgThisExp

Represents the C++ this statement.

class  SgThisExp: public SgExpression {
  // variant == THIS_NODE
public:
  inline SgThisExp (PTR_LLND ll);
  inline SgThisExp(SgType &t);
  inline ~SgThisExp();
};

Member Functions

SgThisExp(PTR_LLND ll)

SgThisExp(SgType &t)


SgKeywordValExp

Represents Fortran keyword values in I/O statements etc..

class  SgKeywordValExp: public SgExpression {
public:
  inline SgKeywordValExp(char *name);
  inline char *value();
};

Member Functions

SgKeywordValExp(char *name)

char *value()


SgRefExp

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();
};

Member Functions

SgRefExp(PTR_LLND ll)

SgRefExp(int variant, SgSymbol &s)


SgVecConstExp

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);
};

Member Functions

SgVecConstExp(PTR_LLND ll)

SgVecConstExp(SgExpression &expr_list)

SgVecConstExp(int n, SgExpression *components)

SgExpression *arg(int i)

int numberOfArgs()

void setArg(int i, SgExpression &e)


SgObjectListExp

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
};

Member Functions

SgObjectListExp(PTR_LLND ll)

SgObjectListExp(int variant, SgSymbol &object, SgExpression &list)

SgObjectListExp(int variant,SgExpression &objectRef, SgExpression &list)

SgSymbol *object()

SgExpression *objectRef()

int listLength()

SgSymbol *symbol(int i)

SgExpression *objectRef(int i)


SgSpecPairExp

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();
};

Member Functions

SgSpecPairExp(PTR_LLND ll)

SgSpecPairExp(SgExpression &arg, SgExpression &value)

SgSpecPairExp(SgExpression &arg)

SgSpecPairExp(char *arg, char *value)

SgExpression *arg()

SgExpression *value()


SgIOAccessExp

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();
};

Member Functions

SgIOAccessExp(PTR_LLND ll)

SgIOAccessExp(SgSymbol &s, SgExpression lbound, SgExpression ubound, SgExpression step)

SgIOAccessExp(SgSymbol &s, SgExpression lbound, SgExpression ubound)


SgImplicitTypeExp

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();
};

Member Functions

SgImplicitTypeExp(PTR_LLND ll)

SgImplicitTypeExp(SgType &type, SgExpression &rangeList)

SgType *type()

SgExpression *rangeList()

char *alphabeticRange()


SgTypeExp

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();
};

Member Functions

SgTypeExp(PTR_LLND ll)

SgTypeExp(SgType &type)

SgType *type()


SgSeqExp

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();
};

Member Functions

SgSeqExp(PTR_LLND ll)

SgSeqExp(SgExpression &exp1, SgExpression &exp2)

SgExpression *front()

SgExpression *rear()


SgStringLengthExp

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();
};

Member Functions

SgStringLengthExp(PTR_LLND ll)

SgStringLengthExp(SgExpression &length)

SgExpression *length()


SgDefaultExp

Represents Fortran default.

class SgDefaultExp: public SgExpression {
  // Fortran default node
  // variant == DEFAULT
public:
  SgDefaultExp(PTR_LLND ll);
  SgDefaultExp();
  ~SgDefaultExp();
};

Member Functions

SgDefaultExp(PTR_LLND ll)

SgDefaultExp()


SgLabelRefExp

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();
};

Member Functions

SgLabelRefExp(PTR_LLND ll)

SgLabelRefExp(SgLabel &label)

SgLabel *label()


SgConstExp

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);
};

Member Functions

SgConstExp(PTR_LLND ll)

SgConstExp(SgExpression &values)

int numberOfArgs()

SgExpression *arg(int i)


SgStructConstExp

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);
};

Member Functions

SgStructConstExp(PTR_LLND ll)

SgStructConstExp(SgSymbol &structName, SgExpression &values)

SgStructConstExp(SgExpression &typeRef, SgExpression &values)

int numberOfArgs()

SgExpression *arg(int i)


SgAttributeExp

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();
};

Member Functions

SgAttributeExp(PTR_LLND ll)

SgAttributeExp(int variant)


SgKeywordArgExp

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();
};

Member Functions

SgKeywordArgExp(PTR_LLND ll)

SgKeywordArgExp(char *argName, SgExpression &exp)

SgSymbol *arg()

SgExpression *value()


SgUseOnlyExp

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();
};

Member Functions

SgUseOnlyExp(PTR_LLND ll)

SgUseOnlyExp(SgExpression &onlyList)

SgExpression *onlyList()


SgUseRenameExp

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();
};

Member Functions

SgUseRenameExp(PTR_LLND ll)

SgUseRenameExp(SgSymbol &newName, SgSymbol &oldName)

SgSymbol *newName()

SgSymbol *oldName()

SgExpression *newNameExp()

SgExpression *oldNameExp()


Exit Sage++ User's Guide