[Rose-commits] r282 - in branches/rice/src: ROSETTA ROSETTA/Grammar ROSETTA/src backend/unparser/FortranCodeGeneration backend/unparser/languageIndependenceSupport frontend/OpenFortranParser_SAGE_Connection

fzhao at osp5.lbl.gov fzhao at osp5.lbl.gov
Thu Feb 26 13:53:00 PST 2009


Author: fzhao
Date: 2009-02-26 13:53:00 -0800 (Thu, 26 Feb 2009)
New Revision: 282

Modified:
   branches/rice/src/ROSETTA/Grammar/Expression.code
   branches/rice/src/ROSETTA/Grammar/Statement.code
   branches/rice/src/ROSETTA/astNodeList
   branches/rice/src/ROSETTA/src/expression.C
   branches/rice/src/ROSETTA/src/statement.C
   branches/rice/src/ROSETTA/src/type.C
   branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_expressions.C
   branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_statements.C
   branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_types.C
   branches/rice/src/backend/unparser/languageIndependenceSupport/modified_sage.C
   branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/FortranParserActionROSE.C
   branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/fortran_support.C
Log:
1. Change "SgTypeCafTeam","SgWithTeam", "SgCoExpression" to be "SgTypeCAFTeamStatement","SgCAFWithTeamStatement" and "SgCAFCoExpression" respectively.
2. Change data member "team id" in "SgCAFWithTeamStatement" and "SgCAFCoExpression" from "SgName" to "SgVarRefExp *" (point to variable declared in a "withteam" stmt.)



Modified: branches/rice/src/ROSETTA/Grammar/Expression.code
===================================================================
--- branches/rice/src/ROSETTA/Grammar/Expression.code	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/ROSETTA/Grammar/Expression.code	2009-02-26 21:53:00 UTC (rev 282)
@@ -979,7 +979,7 @@
           SgType* get_type() const;
 HEADER_USER_DEFINED_BINARY_EXPRESSION_END
 
-// FMZ (2/5/2009) Added for CoExpression
+// FMZ (2/5/2009) Added for CAFCoExpression
 
 HEADER_CO_EXPRESSION_START
 
@@ -5062,11 +5062,11 @@
 SOURCE_USER_DEFINED_BINARY_EXPRESSION_END
 
 
-// FMZ (2/5/200) Added for CoExpression
+// FMZ (2/5/200) Added for CAFCoExpression
 SOURCE_CO_EXPRESSION_START
 
 SgType*
-SgCoExpression::get_type() const
+SgCAFCoExpression::get_type() const
    {
      SgType* returnType = get_referData()->get_type();
      ROSE_ASSERT(returnType != NULL);

Modified: branches/rice/src/ROSETTA/Grammar/Statement.code
===================================================================
--- branches/rice/src/ROSETTA/Grammar/Statement.code	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/ROSETTA/Grammar/Statement.code	2009-02-26 21:53:00 UTC (rev 282)
@@ -4034,7 +4034,7 @@
           case V_SgWhileStmt:
           case V_SgFortranDo:
           case V_SgForAllStatement:
-          case V_SgWithTeamStatement: //FMZ (2/18/2009)
+          case V_SgCAFWithTeamStatement: //FMZ (2/18/2009)
                returnValue = false;
                break;
 
@@ -4759,9 +4759,9 @@
              }
 
           // FMZ (CoArray with team)
-          case V_SgWithTeamStatement:
+          case V_SgCAFWithTeamStatement:
              {
-               const SgWithTeamStatement* teamScope = isSgWithTeamStatement(currentScope);
+               const SgCAFWithTeamStatement* teamScope = isSgCAFWithTeamStatement(currentScope);
                ROSE_ASSERT (teamScope != NULL);
                ROSE_ASSERT (teamScope->get_body() != NULL); 
                return isSgBasicBlock(teamScope->get_body()) ? isSgBasicBlock(teamScope->get_body())->getStatementList() : emptyStatementList;
@@ -13499,7 +13499,7 @@
 
 SOURCE_WITH_TEAM_STATEMEMT_START
 void
-SgWithTeamStatement::post_construction_initialization()
+SgCAFWithTeamStatement::post_construction_initialization()
 {
 }
 

Modified: branches/rice/src/ROSETTA/astNodeList
===================================================================
--- branches/rice/src/ROSETTA/astNodeList	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/ROSETTA/astNodeList	2009-02-26 21:53:00 UTC (rev 282)
@@ -597,6 +597,6 @@
 SgRealPartOp
 SgImagPartOp
 SgConjugateOp
-SgTypeCafTeam
-SgWithTeamStatement
-SgCoExpression
+SgTypeCAFTeam
+SgCAFWithTeamStatement
+SgCAFCoExpression

Modified: branches/rice/src/ROSETTA/src/expression.C
===================================================================
--- branches/rice/src/ROSETTA/src/expression.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/ROSETTA/src/expression.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -184,7 +184,7 @@
      NEW_TERMINAL_MACRO (PointerAssignOp,       "PointerAssignOp",       "POINTER_ASSIGN_OP" );
 
   // FMZ (2/6/2009): Added CoArray Reference Expression
-     NEW_TERMINAL_MACRO (CoExpression,    "CoExpression",    "COARRAY_REF_EXPR" );
+     NEW_TERMINAL_MACRO (CAFCoExpression,    "CAFCoExpression",    "COARRAY_REF_EXPR" );
 
 #endif
 
@@ -231,7 +231,7 @@
           VarArgCopyOp        | VarArgStartOneOperandOp | NullExpression      | VariantExpression   | SubscriptExpression      |
           ColonShapeExp       | AsteriskShapeExp        | /*UseOnlyExpression |*/ ImpliedDo         | IOItemExpression         |
        /* UseRenameExpression | */ StatementExpression  | AsmOp               | LabelRefExp         | ActualArgumentExpression |
-          UnknownArrayOrFunctionReference     | CoExpression,
+          UnknownArrayOrFunctionReference     | CAFCoExpression,
           "Expression","ExpressionTag", false);
 
   // ***********************************************************************
@@ -680,8 +680,8 @@
      UserDefinedUnaryOp.editSubstitute  ( "PRECEDENCE_VALUE", " 2" );
      UserDefinedBinaryOp.editSubstitute ( "PRECEDENCE_VALUE", " 2" );
 
-     // FMZ (2/6/2009): Added for SgCoExpression
-     CoExpression.editSubstitute ( "PRECEDENCE_VALUE", " 2" );
+     // FMZ (2/6/2009): Added for SgCAFCoExpression
+     CAFCoExpression.editSubstitute ( "PRECEDENCE_VALUE", " 2" );
 
 #if 0
   // Extra required Fortran IR nodes
@@ -1425,16 +1425,18 @@
 				       CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
 
 
-     //FMZ (2/5/2009): Added for CoExpression
-     CoExpression.setFunctionPrototype ( "HEADER_CO_EXPRESSION", "../Grammar/Expression.code" );
+     //FMZ (2/5/2009): Added for CAFCoExpression => change teamId from "SgName" to "SgVarRefExp*"
+     CAFCoExpression.setFunctionPrototype ( "HEADER_CO_EXPRESSION", "../Grammar/Expression.code" );
 
-     CoExpression.setDataPrototype ( "SgName", "teamId",  "= \"\"", 
-				          CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS,NO_TRAVERSAL,NO_DELETE);
-     CoExpression.setDataPrototype ( "SgExpression*", "teamRank", "= NULL",
+     //CAFCoExpression.setDataPrototype ( "SgName", "teamId",  "= \"\"", 
+     //				          CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS,NO_TRAVERSAL,NO_DELETE);
+     CAFCoExpression.setDataPrototype ( "SgVarRefExp*", "teamId",  "= NULL", 
+                                          CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
+     CAFCoExpression.setDataPrototype ( "SgExpression*", "teamRank", "= NULL",
 				          CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
-     CoExpression.setDataPrototype ( "SgExpression*", "referData", "= NULL",
+     CAFCoExpression.setDataPrototype ( "SgExpression*", "referData", "= NULL",
 				          CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS,DEF_TRAVERSAL, NO_DELETE);
-     CoExpression.setFunctionSource ( "SOURCE_EMPTY_POST_CONSTRUCTION_INITIALIZATION", 
+     CAFCoExpression.setFunctionSource ( "SOURCE_EMPTY_POST_CONSTRUCTION_INITIALIZATION", 
                                   "../Grammar/Expression.code" );
 
 
@@ -1639,7 +1641,7 @@
      DesignatedInitializer.setFunctionSource ( "SOURCE_DESIGNATED_INITIALIZER", "../Grammar/Expression.code" );
 
      //FMZ (2/6/2009): Added for CoArray Reference
-     CoExpression.setFunctionSource ( "SOURCE_CO_EXPRESSION", "../Grammar/Expression.code" );
+     CAFCoExpression.setFunctionSource ( "SOURCE_CO_EXPRESSION", "../Grammar/Expression.code" );
 
 #if USE_UPC_IR_NODES
   // DQ and Liao (6/10/2008): Added new IR nodes specific to UPC.

Modified: branches/rice/src/ROSETTA/src/statement.C
===================================================================
--- branches/rice/src/ROSETTA/src/statement.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/ROSETTA/src/statement.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -159,7 +159,7 @@
   // FMZ (2/3/2009): Added co-array "withteam" stmt
   //  NEW_TERMINAL_MACRO (WithTeamStatement,         "WithTeamStatement",         "WITHTEAM_DECL_STMT" );
   // FMZ (2/17/2009): We re-defined "withteam" stmt
-    NEW_TERMINAL_MACRO (WithTeamStatement,         "WithTeamStatement",         "WITHTEAM_STMT" );
+    NEW_TERMINAL_MACRO (CAFWithTeamStatement,         "CAFWithTeamStatement",         "WITHTEAM_STMT" );
 
   // DQ (12/18/2007): Added support for Fortran Format statement
      NEW_TERMINAL_MACRO (FormatStatement,           "FormatStatement",           "FORMAT_STATEMENT" );
@@ -268,7 +268,7 @@
           Global                       | BasicBlock         | IfStmt             | ForStatement    | FunctionDefinition |
           ClassDefinition              | WhileStmt          | DoWhileStmt        | SwitchStatement | CatchOptionStmt    |
           NamespaceDefinitionStatement | BlockDataStatement | AssociateStatement | FortranDo       | ForAllStatement    |
-          UpcForAllStatement           | WithTeamStatement
+          UpcForAllStatement           | CAFWithTeamStatement
        /* | TemplateInstantiationDefn */,
           "ScopeStatement","SCOPE_STMT", false);
 
@@ -2112,16 +2112,17 @@
                       //NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
      //WithTeamStatement.setDataPrototype("SgInitializedName", "variable", "",
 		      //NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
-     WithTeamStatement.setFunctionPrototype( "HEADER_WITH_TEAM_STATEMENT", "../Grammar/Statement.code" );
-     WithTeamStatement.setFunctionSource ( "SOURCE_WITH_TEAM_STATEMEMT", "../Grammar/Statement.code" );
+     CAFWithTeamStatement.setFunctionPrototype( "HEADER_WITH_TEAM_STATEMENT", "../Grammar/Statement.code" );
+     CAFWithTeamStatement.setFunctionSource ( "SOURCE_WITH_TEAM_STATEMEMT", "../Grammar/Statement.code" );
 
-     WithTeamStatement.setDataPrototype ( "SgName" , "teamId", "= \"\"",
+     // CAFWithTeamStatement.setDataPrototype ( "SgName" , "teamId", "= \"\"",
+      CAFWithTeamStatement.setDataPrototype ( "SgVarRefExp*" , "teamId", "= NULL",
 	  	  CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
 
-     WithTeamStatement.setDataPrototype ( "SgBasicBlock*", "body", "= NULL",
+     CAFWithTeamStatement.setDataPrototype ( "SgBasicBlock*", "body", "= NULL",
                   CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, DEF_TRAVERSAL, NO_DELETE, CLONE_PTR);
 
-     WithTeamStatement.setDataPrototype ( "bool", "endHasTeamId", "= false",
+     CAFWithTeamStatement.setDataPrototype ( "bool", "endHasTeamId", "= false",
                   NO_CONSTRUCTOR_PARAMETER, BUILD_ACCESS_FUNCTIONS, NO_TRAVERSAL, NO_DELETE);
 
 

Modified: branches/rice/src/ROSETTA/src/type.C
===================================================================
--- branches/rice/src/ROSETTA/src/type.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/ROSETTA/src/type.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -41,7 +41,7 @@
      NEW_TERMINAL_MACRO ( TypeDefault         , "TypeDefault",          "T_DEFAULT" );
      NEW_TERMINAL_MACRO ( PointerMemberType   , "PointerMemberType",    "T_MEMBER_POINTER" );
      NEW_TERMINAL_MACRO ( ReferenceType       , "ReferenceType",        "T_REFERENCE" );
-     NEW_TERMINAL_MACRO ( TypeCafTeam         , "TypeCafTeam",          "T_IMAGE_TEAM" );
+     NEW_TERMINAL_MACRO ( TypeCAFTeam         , "TypeCAFTeam",          "T_CAFTEAM" );
 
   // DQ (5/7/2004): Made this a terminal, was previously a nonterminal 
   // with a TemplateInstantiationType derived from it.
@@ -130,7 +130,7 @@
           TypeLongDouble   | TypeString        | TypeBool          | PointerType          |
           ReferenceType    | NamedType         | ModifierType      | FunctionType         |
           ArrayType        | TypeEllipse       | TemplateType      | QualifiedNameType    |
-          TypeComplex      | TypeImaginary     | TypeDefault       | TypeCafTeam,
+          TypeComplex      | TypeImaginary     | TypeDefault       | TypeCAFTeam,
      "Type","TypeTag", false);
 
 #if 1
@@ -318,7 +318,7 @@
      TypeSignedLongLong.setDataPrototype   ("static $CLASSNAME*","builtin_type","",NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL || TYPE_TRAVERSAL, NO_DELETE, NO_COPY_DATA);
      TypeUnsignedLongLong.setDataPrototype ("static $CLASSNAME*","builtin_type","",NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL || TYPE_TRAVERSAL, NO_DELETE, NO_COPY_DATA);
 
-     TypeCafTeam.setDataPrototype ("static $CLASSNAME*","builtin_type","",NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL || TYPE_TRAVERSAL, NO_DELETE, NO_COPY_DATA);
+     TypeCAFTeam.setDataPrototype ("static $CLASSNAME*","builtin_type","",NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL || TYPE_TRAVERSAL, NO_DELETE, NO_COPY_DATA);
 
      TypeLongDouble.setDataPrototype       ("static $CLASSNAME*","builtin_type","",NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL || TYPE_TRAVERSAL, NO_DELETE, NO_COPY_DATA);
      TypeString.setDataPrototype           ("static $CLASSNAME*","builtin_type","",NO_CONSTRUCTOR_PARAMETER, NO_ACCESS_FUNCTIONS, NO_TRAVERSAL || TYPE_TRAVERSAL, NO_DELETE, NO_COPY_DATA);
@@ -655,7 +655,7 @@
      TypeSignedLongLong.editSubstitute( "MANGLED_ID_STRING", "SL" );
      TypeUnsignedLongLong.editSubstitute( "MANGLED_ID_STRING", "UL" );
 
-     TypeCafTeam.editSubstitute( "MANGLED_ID_STRING", "s" );
+     TypeCAFTeam.editSubstitute( "MANGLED_ID_STRING", "s" );
 
      TypeLongDouble.editSubstitute( "MANGLED_ID_STRING", "ld" );
      TypeString.editSubstitute( "MANGLED_ID_STRING", "str" );

Modified: branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_expressions.C
===================================================================
--- branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_expressions.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_expressions.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -142,7 +142,7 @@
        // DQ (10/10/2008): Added support for unser defined unary and binary operators.
           case V_SgUserDefinedUnaryOp:        unparseUserDefinedUnaryOp (expr, info); break;
           case V_SgUserDefinedBinaryOp:       unparseUserDefinedBinaryOp(expr, info); break;
-          case V_SgCoExpression:              unparseCoArrayExpression(expr, info); break;
+          case V_SgCAFCoExpression:           unparseCoArrayExpression(expr, info); break;
 
 #if 0
        // DQ (8/15/2007): These are handled in the base class
@@ -2142,8 +2142,10 @@
    {
     
     // printf("unparseCoArrayExpresison\n");
+ 
+    bool hasImageSelec = false;
 
-    SgCoExpression* coExpr = isSgCoExpression(expr);  
+    SgCAFCoExpression* coExpr = isSgCAFCoExpression(expr);  
 
     ROSE_ASSERT(coExpr != NULL);
 
@@ -2155,11 +2157,19 @@
 
     unparseLanguageSpecificExpression(dataExpr,info);
 
-    SgName teamID = coExpr->get_teamId();
+    //SgName teamID = coExpr->get_teamId();
+    SgVarRefExp* teamIdRef = coExpr->get_teamId();
 
-    if (teamID!="" || teamRank) {
+     SgInitializedName* teamDecl = NULL;
+    
+    if (teamIdRef) {
+        teamDecl  = teamIdRef->get_symbol()->get_declaration();
+     }
+
+    hasImageSelec =  teamDecl || teamRank;
+
+    if (hasImageSelec) 
         curprint("[");
-    }
 
     if (teamRank) { 
         SgIntVal* intRank = isSgIntVal(teamRank);
@@ -2169,13 +2179,13 @@
         else
            unparseLanguageSpecificExpression(teamRank,info);
     }
-    
-    if (teamID!="") {
+
+
+    if (teamDecl) {
         curprint("@");
-        curprint(teamID.str());
+        curprint(teamDecl->get_name().str());
     }
 
-    if (teamID!="" || teamRank)
+    if (hasImageSelec)
         curprint("]");
-   
-   }
+  }

Modified: branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_statements.C
===================================================================
--- branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_statements.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_statements.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -277,7 +277,7 @@
 
           case V_SgDeallocateStatement:        unparseDeallocateStatement(stmt, info); break;
 
-          case V_SgWithTeamStatement:           unparseWithTeamStatement(stmt, info); break;
+          case V_SgCAFWithTeamStatement:           unparseWithTeamStatement(stmt, info); break;
 
        // Language independent code generation (placed in base class)
        // scope
@@ -5267,11 +5267,18 @@
 void
 FortranCodeGeneration_locatedNode::unparseWithTeamStatement(SgStatement* stmt, SgUnparse_Info& info)
    {
-     SgWithTeamStatement* withTeamStmt = isSgWithTeamStatement(stmt);
+     SgCAFWithTeamStatement* withTeamStmt = isSgCAFWithTeamStatement(stmt);
      ROSE_ASSERT(withTeamStmt != NULL);
      // print out "withteam" stmt
      curprint("WITHTEAM ");
-     curprint(withTeamStmt->get_teamId());
+    // curprint(withTeamStmt->get_teamId());
+    
+     SgVarRefExp* teamIdRef = withTeamStmt->get_teamId(); 
+
+     SgInitializedName* teamDecl = teamIdRef->get_symbol()->get_declaration();
+
+     curprint(teamDecl->get_name().str());
+
      unp->cur.insert_newline(1); 
 
      // unparser the body
@@ -5282,7 +5289,8 @@
 
     // "end withteam()" stmt
      curprint("END WITHTEAM ");
-     curprint(withTeamStmt->get_teamId());
+     //curprint(withTeamStmt->get_teamId());
+     curprint(teamDecl->get_name().str());
      unp->cur.insert_newline(1); 
  
    }

Modified: branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_types.C
===================================================================
--- branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_types.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/backend/unparser/FortranCodeGeneration/unparseFortran_types.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -130,7 +130,7 @@
           case V_SgModifierType:         unparseModifierType(type, info); break; 
 
        // FMZ (2/2/2009): Add image_team for co-array team declaration
-          case V_SgTypeCafTeam:             curprint("IMAGE_TEAM"); break;
+          case V_SgTypeCAFTeam:             curprint("IMAGE_TEAM"); break;
 
 #if 0
        // DQ (8/15/2007): I don't think these apply to Fortran.

Modified: branches/rice/src/backend/unparser/languageIndependenceSupport/modified_sage.C
===================================================================
--- branches/rice/src/backend/unparser/languageIndependenceSupport/modified_sage.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/backend/unparser/languageIndependenceSupport/modified_sage.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -697,7 +697,7 @@
           case V_SgUnsignedLongLongIntVal: return 0;
           case V_SgUnsignedLongVal:  return 0;
           case V_SgComplexVal:       return 0;
-          case V_SgCoExpression:     return 2;
+          case V_SgCAFCoExpression:  return 2;
 #if 0
        // Template
           case V_:              return 0;

Modified: branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/FortranParserActionROSE.C
===================================================================
--- branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/FortranParserActionROSE.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/FortranParserActionROSE.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -6394,17 +6394,17 @@
      outputState("At TOP of R612 c_action_data_ref()");
 #endif
 
-  // FMZ (2/11/2009): Here we could have SgCoExpression in the astExpressionStack
+  // FMZ (2/11/2009): Here we could have SgCAFCoExpression in the astExpressionStack
   // We need to pop out the SgNode to complete whatever need to be done regularly
   //  (without co-array image selector)
      bool isCoarray = false;
-     SgCoExpression* coExpr = NULL;
+     SgCAFCoExpression* coExpr = NULL;
      if (astExpressionStack.empty() == false) {
-          isCoarray=(astExpressionStack.front()->variantT()==V_SgCoExpression);
+          isCoarray=(astExpressionStack.front()->variantT()==V_SgCAFCoExpression);
       }
 
      if (isCoarray) { //need to pop out the CoExpresion first
-           coExpr = isSgCoExpression(astExpressionStack.front());
+           coExpr = isSgCAFCoExpression(astExpressionStack.front());
            ROSE_ASSERT(coExpr != NULL);
            astExpressionStack.pop_front();
         }
@@ -16999,7 +16999,7 @@
 /**
  *     variable declared: A(:)[*], SA[*]
  *     variable refer:    A(12)[1 at team1], SA[1 at team1] A(12)[1] and SA[1]
- *     generate:          SgCoExpression(teamID, teamRank, Expression*)
+ *     generate:          SgCAFCoExpression(teamID, teamRank, Expression*)
 */
 void c_action_rice_image_selector(Token_t *team_id) 
     {
@@ -17015,6 +17015,22 @@
        if ( SgProject::get_verbose() > DEBUG_COMMENT_LEVEL )
           printf ("In c_action_declaration_construct() \n");
 
+       SgVarRefExp* teamIdReference = NULL;
+
+       if (team_id) {
+           SgVariableSymbol* teamId = trace_back_through_parent_scopes_lookup_variable_symbol(team_id->text,
+                                                                                         astScopeStack.front());
+           if (teamId == NULL) {
+             printf("ERROR(CAF): The team selector:\"%s\" must be declared with \"image_team\" statement.\n",
+                                                                                        team_id->text); 
+                ROSE_ASSERT(false);
+           }
+
+           teamIdReference = new SgVarRefExp(teamId);
+
+           setSourcePosition(teamIdReference,team_id);
+        }
+
        SgExpression* rankExpr = astExpressionStack.front();
 
 #if 0
@@ -17033,7 +17049,7 @@
 
        SgExpression* dataExpr = NULL;
 
-       SgCoExpression* coExpr = new SgCoExpression("",rankExpr,dataExpr);
+       SgCAFCoExpression* coExpr = new SgCAFCoExpression(teamIdReference,rankExpr,dataExpr);
 
 #if 0
        if (team_id) {
@@ -17062,11 +17078,25 @@
      if ( SgProject::get_verbose() > DEBUG_COMMENT_LEVEL )
           printf ("In c_action_rice_allocate_co_array_spec() \n");
 
+     SgVarRefExp* teamIdReference = NULL;
+
+     if (team_id) {
+           SgVariableSymbol* teamId = trace_back_through_parent_scopes_lookup_variable_symbol(team_id->text,                                                                                          astScopeStack.front());
+
+           ROSE_ASSERT(teamId != NULL);
+
+           teamIdReference = new SgVarRefExp(teamId);
+
+           setSourcePosition(teamIdReference,team_id);
+        }
+
+
      SgExpression* dataExpr = astExpressionStack.front();
 
      astExpressionStack.pop_front();
 
-     SgCoExpression* coExpr = new SgCoExpression(team_id->text,NULL,dataExpr);
+     //SgCAFCoExpression* coExpr = new SgCAFCoExpression(team_id->text,NULL,dataExpr);
+     SgCAFCoExpression* coExpr = new SgCAFCoExpression(teamIdReference,NULL,dataExpr);
 
      coExpr->set_parent(dataExpr->get_parent());
 
@@ -17103,7 +17133,20 @@
 
     setSourcePosition(body,team_id);
 
-    SgWithTeamStatement *withTeam = new SgWithTeamStatement(team_id->text, body);
+    SgVariableSymbol* teamId = trace_back_through_parent_scopes_lookup_variable_symbol(team_id->text,
+                                                                                         astScopeStack.front());
+    if (teamId == NULL) {
+         printf("ERROR(CAF): The team selector:\"%s\" must be declared with \"image_team\" statement.\n",
+                                                                                        team_id->text);
+         ROSE_ASSERT(false);
+     }
+
+    SgVarRefExp* teamIdReference = new SgVarRefExp(teamId);
+    ROSE_ASSERT(teamIdReference != NULL);
+
+    setSourcePosition(teamIdReference,team_id);
+
+    SgCAFWithTeamStatement *withTeam = new SgCAFWithTeamStatement(teamIdReference, body);
    
     setSourcePosition(withTeam,team_id);
 

Modified: branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/fortran_support.C
===================================================================
--- branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/fortran_support.C	2009-02-26 20:46:26 UTC (rev 281)
+++ branches/rice/src/frontend/OpenFortranParser_SAGE_Connection/fortran_support.C	2009-02-26 21:53:00 UTC (rev 282)
@@ -517,8 +517,8 @@
 	  // We need to create a new SgType for the team
           //case IntrinsicTypeSpec_IMAGETEAM:       result = SgTypeBool::createType();    break;
  
-          // FMZ (2/2/2009): generate SgCafTeamType for the image_type
-          case IntrinsicTypeSpec_IMAGETEAM:       result = SgTypeCafTeam::createType();    break;
+          // FMZ (2/2/2009): generate SgCAFTeamType for the image_type
+          case IntrinsicTypeSpec_IMAGETEAM:       result = SgTypeCAFTeam::createType();    break;
 
           default:
              {



More information about the Rose-commits mailing list