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

Non-Member Functions

Type Functions

SgType *SgTypeInt();
SgType *SgTypeChar();
SgType *SgTypeFloat();
SgType *SgTypeDouble();
SgType *SgTypeVoid();
SgType *SgTypeBool();
SgType *SgTypeDefault();

The functions above return pointers to basic builtin types that are always included in the type table. Therefore, the SgTypeInt() function, for example, will always return the same pointer, no matter how many times it is called. This is the recommended way to get builtin types in Sage++.

Unary Functions

SgUnaryExp & SgDerefOp(SgExpression &e);
SgUnaryExp & SgAddrOp(SgExpression &e);
SgUnaryExp & SgUMinusOp(SgExpression &e);
SgUnaryExp & SgUPlusOp(SgExpression &e);
SgUnaryExp & SgPrePlusPlusOp(SgExpression &e);
SgUnaryExp & SgPreMinusMinusOp(SgExpression &e);
SgUnaryExp & SgPostPlusPlusOp(SgExpression &e);
SgUnaryExp & SgPostMinusMinusOp(SgExpression &e);
SgUnaryExp & SgBitCompfOp(SgExpression &e);
SgUnaryExp & SgNotOp(SgExpression &e);
SgUnaryExp & SgSizeOfOp(SgExpression &e);
SgUnaryExp & makeAnUnaryExpression(int code,PTR_LLND ll1);

The functions above are used to construct instances of SgUnaryExp class corresponding to different variants. These are non-member functions rather than constructors because there are no separate subclasses of SgUnaryExp corresponding to different variants.

Example Usage

To construct the expression:

     sizeof(int *)

you first need to create the correct type expression for an int *.

     SgPointerType *intp = new SgPointerType(*SgTypeInt());

Then you make the cast operator:

     SgCastExp *castop = new SgCastExp(*intp);

After that you can make the sizeof expression:

     SgExpression *e = SgSizeOfOp(*castop);

Casting Functions

SgValueExp *             isSgValueExp(SgExpression *pt);
SgKeywordValExp *        isSgKeywordValExp(SgExpression *pt);
SgCastExp *              isSgCastExp(SgExpression *pt);
SgDeleteExp *            isSgDeleteExp(SgExpression *pt);
SgNewExp *               isSgNewExp(SgExpression *pt);
SgExprIfExp *            isSgExprIfExp(SgExpression *pt);
SgFunctionCallExp *      isSgFunctionCallExp(SgExpression *pt);
SgFuncPntrExp *          isSgFuncPntrExp(SgExpression *pt);
SgExprListExp *          isSgExprListExp(SgExpression *pt);
SgRefExp *               isSgRefExp (SgExpression *pt);
SgVarRefExp *            isSgVarRefExp (SgExpression *pt);
SgThisExp *              isSgThisExp (SgExpression *pt);
SgArrayRefExp *          isSgArrayRefExp (SgExpression *pt);
SgPntrArrRefExp *        isSgPntrArrRefExp(SgExpression *pt);
SgPointerDerefExp *      isSgPointerDerefExp (SgExpression *pt);
SgRecordRefExp *         isSgRecordRefExp (SgExpression *pt);
SgStructConstExp*        isSgStructConstExp (SgExpression *pt);
SgConstExp*              isSgConstExp (SgExpression *pt);
SgVecConstExp *          isSgVecConstExp (SgExpression *pt);
SgInitListExp *          isSgInitListExp (SgExpression *pt);
SgObjectListExp *        isSgObjectListExp (SgExpression *pt);
SgAttributeExp *         isSgAttributeExp (SgExpression *pt);
SgKeywordArgExp *        isSgKeywordArgExp (SgExpression *pt);
SgSubscriptExp*          isSgSubscriptExp (SgExpression *pt);
SgUseOnlyExp *           isSgUseOnlyExp (SgExpression *pt);
SgUseRenameExp *         isSgUseRenameExp (SgExpression *pt);
SgSpecPairExp *          isSgSpecPairExp (SgExpression *pt);
SgIOAccessExp *          isSgIOAccessExp (SgExpression *pt);
SgImplicitTypeExp *      isSgImplicitTypeExp (SgExpression *pt);
SgTypeExp *              isSgTypeExp (SgExpression *pt);
SgSeqExp *               isSgSeqExp (SgExpression *pt);
SgStringLengthExp *      isSgStringLengthExp (SgExpression *pt);
SgDefaultExp *           isSgDefaultExp (SgExpression *pt);
SgLabelRefExp *          isSgLabelRefExp (SgExpression *pt);
SgProgHedrStmt *         isSgProgHedrStmt (SgStatement *pt);
SgProcHedrStmt *         isSgProcHedrStmt (SgStatement *pt);
SgFuncHedrStmt *         isSgFuncHedrStmt (SgStatement *pt);
SgClassStmt *            isSgClassStmt (SgStatement *pt);
SgStructStmt *           isSgStructStmt (SgStatement *pt);
SgUnionStmt *            isSgUnionStmt (SgStatement *pt);
SgEnumStmt *             isSgEnumStmt (SgStatement *pt);
SgCollectionStmt *       isSgCollectionStmt (SgStatement *pt);
SgBasicBlockStmt *       isSgBasicBlockStmt (SgStatement *pt);
SgForStmt *              isSgForStmt (SgStatement *pt);
SgWhileStmt *            isSgWhileStmt (SgStatement *pt);
SgDoWhileStmt *          isSgDoWhileStmt (SgStatement *pt);
SgLogIfStmt *            isSgLogIfStmt (SgStatement *pt);
SgIfStmt *               isSgIfStmt (SgStatement *pt);
SgArithIfStmt *          isSgArithIfStmt (SgStatement *pt);
SgWhereStmt *            isSgWhereStmt (SgStatement *pt);
SgWhereBlockStmt *       isSgWhereBlockStmt (SgStatement *pt);
SgSwitchStmt *           isSgSwitchStmt (SgStatement *pt);
SgCaseOptionStmt *       isSgCaseOptionStmt (SgStatement *pt);
SgExecutableStatement *  isSgExecutableStatement (SgStatement *pt);
SgAssignStmt *           isSgAssignStmt (SgStatement *pt);
SgCExpStmt *             isSgCExpStmt (SgStatement *pt);
SgPointerAssignStmt *    isSgPointerAssignStmt (SgStatement *pt);
SgHeapStmt *             isSgHeapStmt (SgStatement *pt);
SgNullifyStmt *          isSgNullifyStmt (SgStatement *pt);
SgContinueStmt *         isSgContinueStmt (SgStatement *pt);
SgControlEndStmt *       isSgControlEndStmt (SgStatement *pt);
SgBreakStmt *            isSgBreakStmt (SgStatement *pt);
SgCycleStmt *            isSgCycleStmt (SgStatement *pt);
SgReturnStmt *           isSgReturnStmt (SgStatement *pt);
SgExitStmt *             isSgExitStmt (SgStatement *pt);
SgGotoStmt *             isSgGotoStmt (SgStatement *pt);
SgLabelListStmt *        isSgLabelListStmt (SgStatement *pt);
SgAssignedGotoStmt *     isSgAssignedGotoStmt (SgStatement *pt);
SgComputedGotoStmt *     isSgComputedGotoStmt (SgStatement *pt);
SgStopOrPauseStmt *      isSgStopOrPauseStmt (SgStatement *pt);
SgCallStmt*              isSgCallStmt (SgStatement *pt);
SgIOStmt *               isSgIOStmt (SgStatement *pt);
SgInputOutputStmt *      isSgInputOutputStmt (SgStatement *pt);
SgIOControlStmt *        isSgIOControlStmt (SgStatement *pt);
SgDeclarationStatement * isSgDeclarationStatement (SgStatement *pt);
SgVarDeclStmt *          isSgVarDeclStmt (SgStatement *pt);
SgVarListDeclStmt *      isSgVarListDeclStmt (SgStatement *pt);
SgStructureDeclStmt *    isSgStructureDeclStmt (SgStatement *pt);
SgNestedVarListDeclStmt* isSgNestedVarListDeclStmt (SgStatement *pt);
SgParameterStmt *        isSgParameterStmt (SgStatement *pt);
SgImplicitStmt *         isSgImplicitStmt (SgStatement *pt);
SgVariableSymb *         isSgVariableSymb (SgSymbol *pt);
SgConstantSymb *         isSgConstantSymb (SgSymbol *pt);
SgFunctionSymb *         isSgFunctionSymb (SgSymbol *pt);
SgMemberFuncSymb *       isSgMemberFuncSymb (SgSymbol *pt);
SgFieldSymb *            isSgFieldSymb (SgSymbol *pt);
SgClassSymb *            isSgClassSymb (SgSymbol *pt);
SgLabelSymb *            isSgLabelSymb (SgSymbol *pt);
SgLabelVarSymb *         isSgLabelVarSymb (SgSymbol *pt);
SgExternalSymb *         isSgExternalSymb (SgSymbol *pt);
SgConstructSymb *        isSgConstructSymb (SgSymbol *pt);
SgInterfaceSymb *        isSgInterfaceSymb (SgSymbol *pt);
SgModuleSymb *           isSgModuleSymb (SgSymbol *pt);
SgArrayType *            isSgArrayType (SgType *pt);
SgPointerType *          isSgPointerType (SgType *pt);
SgReferenceType *        isSgReferenceType (SgType *pt);
SgDerivedType *          isSgDerivedType (SgType *pt);
SgDerivedClassType *     isSgDerivedClassType (SgType *pt);
SgDescriptType *         isSgDescriptType (SgType *pt);
SgDerivedCollectionType* isSgDerivedCollectionType (SgType *pt);

Exit Sage++ User's Guide