Fix reductiontarget code generation for groups and nodegroups
authorAaron Becker <akbecker@gmail.com>
Thu, 24 Feb 2011 00:43:51 +0000 (18:43 -0600)
committerAaron Becker <akbecker@gmail.com>
Thu, 24 Feb 2011 00:45:12 +0000 (18:45 -0600)
src/xlat-i/xi-symbol.C

index 038bbd80fb5a1936cdee5b51f7626d33b9d3f009..edde5b07c6da2acdcf789dc4690ab16c96d6ce2c 100644 (file)
@@ -3126,16 +3126,6 @@ void Entry::genChareDefs(XStr& str)
     }
     str << "}\n";
   }
-  if (isReductionTarget()) {
-      XStr retStr; retStr<<retType;
-      str << retType << " " << indexName(); //makeDecl(retStr, 1)
-      str << "::_" << name << "_redn_wrapper(void* impl_msg, " 
-          << container->baseName() << "* impl_obj)\n{\n"
-          << "  char* impl_buf = (char*)((CkReductionMsg*)impl_msg)->getData();\n";
-      XStr precall;
-      genCall(str, precall, true);
-      str << "\n}\n\n";
-  }
 }
 
 void Entry::genChareStaticConstructorDecl(XStr& str)
@@ -4539,6 +4529,20 @@ void Entry::genDefs(XStr& str)
   } else
     genChareDefs(str);
 
+  if (container->isChare() || container->isForElement()) {
+      if (isReductionTarget()) {
+          XStr retStr; retStr<<retType;
+          str << retType << " " << indexName(); //makeDecl(retStr, 1)
+          str << "::_" << name << "_redn_wrapper(void* impl_msg, "
+              << container->baseName() << "* impl_obj)\n{\n"
+              << "  char* impl_buf = (char*)((CkReductionMsg*)impl_msg)->getData();\n";
+          XStr precall;
+          genCall(str, precall, true);
+          str << "\n}\n\n";
+      }
+  }
+
+
   //Prevents repeated call and __idx definitions:
   if (container->getForWhom()!=forAll) return;