00001 #include "CParsedFile.h"
00002 #include "CStateVar.h"
00003 #include "EToken.h"
00004 #include "constructs/Constructs.h"
00005 #include "sdag-globals.h"
00006 #include "xi-Chare.h"
00007 #include "xi-symbol.h"
00008 #include <list>
00009 #include <stdlib.h>
00010 #include <string.h>
00011 using std::list;
00012 #include <algorithm>
00013 using std::for_each;
00014
00015 #if __cplusplus < 201103L
00016 #include <functional>
00017 using std::mem_fun;
00018 #endif
00019
00020 namespace xi {
00021 SdagConstruct::SdagConstruct(EToken t, SdagConstruct* construct1) {
00022 init(t);
00023 constructs->push_back(construct1);
00024 }
00025
00026 SdagConstruct::SdagConstruct(EToken t, SdagConstruct* construct1, SdagConstruct* aList) {
00027 init(t);
00028 constructs->push_back(construct1);
00029 constructs->insert(constructs->end(), aList->constructs->begin(),
00030 aList->constructs->end());
00031 }
00032
00033 SdagConstruct::SdagConstruct(EToken t, XStr* txt, SdagConstruct* c1, SdagConstruct* c2,
00034 SdagConstruct* c3, SdagConstruct* c4,
00035 SdagConstruct* constructAppend, EntryList* el) {
00036 init(t);
00037 text = txt;
00038 con1 = c1;
00039 con2 = c2;
00040 con3 = c3;
00041 con4 = c4;
00042 if (constructAppend != 0) constructs->push_back(constructAppend);
00043 elist = el;
00044 }
00045
00046 SdagConstruct::SdagConstruct(EToken t, const char* entryStr, const char* codeStr,
00047 ParamList* pl) {
00048 init(t);
00049 text = new XStr(codeStr);
00050 param = pl;
00051 }
00052
00053 void SdagConstruct::init(EToken& t) {
00054 con1 = 0;
00055 con2 = 0;
00056 con3 = 0;
00057 con4 = 0;
00058 traceName = 0;
00059 elist = 0;
00060 constructs = new list<SdagConstruct*>();
00061 type = t;
00062 label_str = 0;
00063 }
00064
00065 SdagConstruct::~SdagConstruct() {
00066 delete constructs;
00067 delete text;
00068 }
00069
00070 void SdagConstruct::numberNodes(void) {
00071 if (constructs != 0)
00072 for_each(constructs->begin(), constructs->end(),
00073 #if __cplusplus < 201103L
00074 mem_fun(&SdagConstruct::numberNodes));
00075 #else
00076 [](SdagConstruct * c) { c->numberNodes(); } );
00077 #endif
00078 }
00079
00080 XStr* SdagConstruct::createLabel(const char* str, int nodeNum) {
00081 char text[128];
00082 if (nodeNum != -1)
00083 sprintf(text, "_%s_%d", str, nodeNum);
00084 else
00085 sprintf(text, "%s", str);
00086
00087 return new XStr(text);
00088 }
00089
00090 void SdagConstruct::labelNodes() {
00091 if (label_str != 0) label = createLabel(label_str, nodeNum);
00092
00093 if (constructs != 0)
00094 for_each(constructs->begin(), constructs->end(),
00095 #if __cplusplus < 201103L
00096 mem_fun(&SdagConstruct::labelNodes));
00097 #else
00098 [](SdagConstruct * c) { c->labelNodes(); } );
00099 #endif
00100 }
00101
00102 void EntryList::generateEntryList(list<CEntry*>& CEntrylist, WhenConstruct* thisWhen) {
00103 EntryList* el = this;
00104 while (el != NULL) {
00105 el->entry->generateEntryList(CEntrylist, thisWhen);
00106 el = el->next;
00107 }
00108 }
00109
00110 void Entry::generateEntryList(list<CEntry*>& CEntrylist, WhenConstruct* thisWhen) {
00111
00112 bool found = false;
00113
00114 for (list<CEntry*>::iterator entry = CEntrylist.begin(); entry != CEntrylist.end();
00115 ++entry) {
00116 if (*((*entry)->entry) == (const char*)name) {
00117 ParamList* epl;
00118 epl = (*entry)->paramlist;
00119 ParamList* pl;
00120 pl = param;
00121 found = false;
00122 if (((*entry)->paramlist->isVoid() == 1) && (pl->isVoid() == 1)) {
00123 found = true;
00124 }
00125 while ((pl != NULL) && (epl != NULL)) {
00126 bool kindMatches =
00127 (pl->isArray() && epl->isArray()) || (pl->isBuiltin() && epl->isBuiltin()) ||
00128 (pl->isReference() && epl->isReference()) ||
00129 (pl->isMessage() && epl->isMessage()) || (pl->isNamed() && epl->isNamed());
00130 bool baseNameMatches = (strcmp(pl->getBaseName(), epl->getBaseName()) == 0);
00131 if (kindMatches && baseNameMatches) found = true;
00132
00133 pl = pl->next;
00134 epl = epl->next;
00135 }
00136 if (((pl == NULL) && (epl != NULL)) || ((pl != NULL) && (epl == NULL)))
00137 found = false;
00138 if (found) {
00139
00140 bool whenFound = false;
00141 for (list<WhenConstruct*>::iterator it = (*entry)->whenList.begin();
00142 it != (*entry)->whenList.end(); ++it) {
00143 if ((*it)->nodeNum == thisWhen->nodeNum) whenFound = true;
00144 }
00145 if (!whenFound) (*entry)->whenList.push_back(thisWhen);
00146 entryPtr = *entry;
00147 if (intExpr != 0) (*entry)->refNumNeeded = 1;
00148 }
00149 }
00150 }
00151 if (!found) {
00152 CEntry* newEntry;
00153 newEntry = new CEntry(new XStr(name), param, estateVars, paramIsMarshalled(),
00154 first_line_, last_line_);
00155 CEntrylist.push_back(newEntry);
00156 entryPtr = newEntry;
00157 newEntry->whenList.push_back(thisWhen);
00158 if (intExpr != 0) newEntry->refNumNeeded = 1;
00159 }
00160
00161 }
00162
00163 void SdagConstruct::generateEntryList(list<CEntry*>& CEntrylist,
00164 WhenConstruct* thisWhen) {
00165 if (SIF == type && con2 != 0) con2->generateEntryList(CEntrylist, thisWhen);
00166 generateChildrenEntryList(CEntrylist, thisWhen);
00167 }
00168
00169 void SdagConstruct::generateChildrenEntryList(list<CEntry*>& CEntrylist,
00170 WhenConstruct* thisWhen) {
00171 if (constructs != 0)
00172 for (list<SdagConstruct*>::iterator it = constructs->begin(); it != constructs->end();
00173 ++it)
00174 (*it)->generateEntryList(CEntrylist, thisWhen);
00175 }
00176
00177 void SdagConstruct::propagateState(int uniqueVarNum) {
00178 CStateVar* sv;
00179 list<EncapState*> encap;
00180
00181 stateVars = new list<CStateVar*>();
00182 ParamList* pl = param;
00183 if (!pl->isVoid()) {
00184 while (pl != NULL) {
00185 stateVars->push_back(new CStateVar(pl));
00186 pl = pl->next;
00187 }
00188
00189 EncapState* state = new EncapState(this->entry, *stateVars);
00190 if (!this->entry->paramIsMarshalled() && !this->entry->param->isVoid())
00191 state->isMessage = true;
00192 encap.push_back(state);
00193 }
00194
00195 encapState = encap;
00196
00197 #if CMK_BIGSIM_CHARM
00198
00199 stateVarsChildren = new list<CStateVar*>(*stateVars);
00200 sv = new CStateVar(0, "void *", 0, "_bgParentLog", 0, NULL, 1);
00201 sv->isBgParentLog = true;
00202 stateVarsChildren->push_back(sv);
00203
00204 {
00205 list<CStateVar*> lst;
00206 lst.push_back(sv);
00207 EncapState* state = new EncapState(NULL, lst);
00208 state->type = new XStr("void");
00209 state->name = new XStr("_bgParentLog");
00210 state->isBgParentLog = true;
00211 encapStateChild.push_back(state);
00212 encap.push_back(state);
00213 }
00214 #else
00215 stateVarsChildren = stateVars;
00216 #endif
00217
00218 encapStateChild = encap;
00219
00220 list<CStateVar*> whensEntryMethodStateVars;
00221 for (list<SdagConstruct*>::iterator it = constructs->begin(); it != constructs->end();
00222 ++it)
00223 (*it)->propagateState(encap, *stateVarsChildren, whensEntryMethodStateVars,
00224 uniqueVarNum);
00225 }
00226
00227 void SdagConstruct::propagateState(list<EncapState*> encap, list<CStateVar*>& plist,
00228 list<CStateVar*>& wlist, int uniqueVarNum) {
00229 CStateVar* sv;
00230 list<CStateVar*>* whensEntryMethodStateVars = NULL;
00231
00232 encapState = encap;
00233
00234 stateVars = new list<CStateVar*>();
00235 switch (type) {
00236 case SINT_EXPR:
00237 case SIDENT:
00238 case SENTRY:
00239 case SELIST:
00240 break;
00241 default:
00242 fprintf(stderr, "internal error in sdag translator..\n");
00243 exit(1);
00244 break;
00245 }
00246
00247 encapStateChild = encap;
00248
00249 propagateStateToChildren(encap, *stateVarsChildren, wlist, uniqueVarNum);
00250 delete whensEntryMethodStateVars;
00251 }
00252
00253 void SdagConstruct::propagateStateToChildren(list<EncapState*> encap,
00254 list<CStateVar*>& stateVarsChildren,
00255 list<CStateVar*>& wlist, int uniqueVarNum) {
00256 if (constructs != 0)
00257 for (list<SdagConstruct*>::iterator it = constructs->begin(); it != constructs->end();
00258 ++it)
00259 (*it)->propagateState(encap, stateVarsChildren, wlist, uniqueVarNum);
00260 }
00261
00262 void SdagConstruct::generateCode(XStr& decls, XStr& defs, Entry* entry) {
00263 generateChildrenCode(decls, defs, entry);
00264 }
00265
00266 void SdagConstruct::generateChildrenCode(XStr& decls, XStr& defs, Entry* entry) {
00267 if (constructs != 0)
00268 for (list<SdagConstruct*>::iterator it = constructs->begin(); it != constructs->end();
00269 ++it)
00270 (*it)->generateCode(decls, defs, entry);
00271 }
00272
00273 void SdagConstruct::buildTypes(list<EncapState*>& state) {
00274 for (list<EncapState*>::iterator iter = state.begin(); iter != state.end(); ++iter) {
00275 EncapState& encap = **iter;
00276 if (!encap.type) {
00277 if (encap.entry->entryPtr && encap.entry->entryPtr->decl_entry)
00278 encap.type = encap.entry->entryPtr->decl_entry->genClosureTypeNameProxyTemp;
00279 else
00280 encap.type = encap.entry->genClosureTypeNameProxyTemp;
00281 }
00282 }
00283 }
00284
00285 int SdagConstruct::unravelClosuresBegin(XStr& defs, bool child) {
00286 int cur = 0;
00287
00288 list<EncapState*>& encaps = child ? encapStateChild : encapState;
00289
00290
00291 for (list<EncapState*>::iterator iter = encaps.begin(); iter != encaps.end();
00292 ++iter, ++cur) {
00293 EncapState& state = **iter;
00294
00295 indentBy(defs, cur + 1);
00296
00297 defs << "{\n";
00298
00299 int i = 0;
00300 for (list<CStateVar*>::iterator iter2 = state.vars.begin(); iter2 != state.vars.end();
00301 ++iter2, ++i) {
00302 CStateVar& var = **iter2;
00303
00304
00305
00306 if (!var.isCounter && !var.isSpeculator && !var.isBgParentLog) {
00307 if (var.isRdma) {
00308 if (var.isFirstRdma) {
00309 defs << "#if CMK_ONESIDED_IMPL\n";
00310 indentBy(defs, cur + 2);
00311 defs << "int "
00312 << "& num_rdma_fields = ";
00313 defs << "gen" << cur;
00314 defs << "->"
00315 << "getP" << i << "();\n";
00316 defs << "#else\n";
00317 i++;
00318 defs << "#endif\n";
00319 }
00320 defs << "#if CMK_ONESIDED_IMPL\n";
00321 indentBy(defs, cur + 2);
00322 defs << "CkNcpyBuffer "
00323 << "& ncpyBuffer_" << var.name << " = ";
00324 defs << "gen" << cur << "->"
00325 << "getP" << i << "();\n";
00326 indentBy(defs, cur + 2);
00327 defs << var.type << "* " << var.name << " = "
00328 << "(" << var.type << "*) (ncpyBuffer_" << var.name << ".ptr);\n";
00329 defs << "#else\n";
00330 indentBy(defs, cur + 2);
00331 defs << var.type << "*"
00332 << "& " << var.name << " = ";
00333 defs << "gen" << cur << "->"
00334 << "getP" << i << "();\n";
00335 defs << "#endif\n";
00336 } else {
00337 indentBy(defs, cur + 2);
00338 defs << var.type << (var.arrayLength || var.isMsg ? "*" : "") << "& "
00339 << var.name << " = ";
00340 state.name ? (defs << *state.name) : (defs << "gen" << cur);
00341 if (!var.isMsg)
00342 defs << "->"
00343 << "getP" << i << "();\n";
00344 else
00345 defs << ";\n";
00346 }
00347 }
00348 }
00349 }
00350
00351 return cur + 1;
00352 }
00353
00354 void SdagConstruct::unravelClosuresEnd(XStr& defs, bool child) {
00355 list<EncapState*>& encaps = child ? encapStateChild : encapState;
00356
00357 int cur = encaps.size();
00358
00359
00360 for (list<EncapState*>::iterator iter = encaps.begin(); iter != encaps.end();
00361 ++iter, --cur) {
00362 EncapState& state = **iter;
00363
00364 indentBy(defs, cur);
00365
00366 defs << "}\n";
00367 }
00368 }
00369
00370 void generateVarSignature(XStr& str, const XStr* name, const char* suffix,
00371 list<CStateVar*>* params) {}
00372 void generateVarSignature(XStr& decls, XStr& defs, const Entry* entry, bool declareStatic,
00373 const char* returnType, const XStr* name, bool isEnd,
00374 list<CStateVar*>* params) {
00375 generateVarSignature(decls, defs, entry->getContainer(), declareStatic, returnType,
00376 name, isEnd, params);
00377 }
00378 void generateVarSignature(XStr& decls, XStr& defs, const Chare* chare, bool declareStatic,
00379 const char* returnType, const XStr* name, bool isEnd,
00380 list<CStateVar*>* params) {
00381 decls << " " << (declareStatic ? "static " : "") << returnType << " ";
00382
00383 templateGuardBegin(false, defs);
00384 defs << chare->tspec() << returnType << " " << chare->baseName() << "::";
00385
00386 XStr op;
00387
00388 op << name;
00389 if (isEnd) op << "_end";
00390 op << "(";
00391
00392 if (params) {
00393 CStateVar* sv;
00394 int count = 0;
00395 for (list<CStateVar*>::iterator iter = params->begin(); iter != params->end();
00396 ++iter) {
00397 CStateVar* sv = *iter;
00398 if (sv->isVoid != 1) {
00399 if (count != 0) op << ", ";
00400
00401
00402
00403
00404 if (sv->type != 0) op << sv->type << " ";
00405 if (sv->declaredRef) op << " &";
00406 if (sv->arrayLength != NULL) op << "* ";
00407 if (sv->name != 0) op << sv->name;
00408
00409 count++;
00410 }
00411 }
00412 }
00413
00414 op << ")";
00415
00416 decls << op << ";\n";
00417 defs << op << " { // Potentially missing " << chare->baseName()
00418 << "_SDAG_CODE in your class definition?\n";
00419 }
00420 void endMethod(XStr& op) {
00421 op << "}\n";
00422 templateGuardEnd(op);
00423 op << "\n\n";
00424 }
00425
00426 void generateClosureSignature(XStr& decls, XStr& defs, const Entry* entry,
00427 bool declareStatic, const char* returnType,
00428 const XStr* name, bool isEnd, list<EncapState*> encap,
00429 int numRefs) {
00430 generateClosureSignature(decls, defs, entry->getContainer(), declareStatic, returnType,
00431 name, isEnd, encap, numRefs);
00432 }
00433 void generateClosureSignature(XStr& decls, XStr& defs, const Chare* chare,
00434 bool declareStatic, const char* returnType,
00435 const XStr* name, bool isEnd, list<EncapState*> encap,
00436 int numRefs) {
00437 decls << " " << (declareStatic ? "static " : "") << returnType << " ";
00438
00439 templateGuardBegin(false, defs);
00440 defs << chare->tspec() << returnType << " " << chare->baseName() << "::";
00441
00442 XStr op;
00443
00444 op << name;
00445 if (isEnd) op << "_end";
00446 op << "(";
00447
00448 int cur = 0;
00449 for (list<EncapState*>::iterator iter = encap.begin(); iter != encap.end();
00450 ++iter, ++cur) {
00451 EncapState* state = *iter;
00452
00453 if (state->type) {
00454 op << *state->type << "* ";
00455 if (state->name)
00456 op << *state->name;
00457 else
00458 op << "gen" << cur;
00459 } else {
00460 fprintf(stderr, "type was not propagated to this phase");
00461 exit(120);
00462 }
00463
00464 if (cur != encap.size() - 1) op << ", ";
00465 }
00466
00467 for (int i = 0; i < numRefs; i++)
00468 op << ((cur + i) > 0 ? ", " : "") << "int refnum_" << i;
00469
00470 op << ")";
00471
00472 decls << op << ";\n";
00473 defs << op << " {\n";
00474 }
00475
00476 void SdagConstruct::generateCall(XStr& op, list<EncapState*>& scope,
00477 list<EncapState*>& next, const XStr* name,
00478 const char* nameSuffix) {
00479 op << name << (nameSuffix ? nameSuffix : "") << "(";
00480
00481 int cur = 0;
00482 for (list<EncapState*>::iterator iter = next.begin(); iter != next.end();
00483 ++iter, ++cur) {
00484 EncapState* state = *iter;
00485
00486 if (state->type) {
00487 if (cur >= scope.size()) {
00488 int offset = cur - scope.size();
00489 if (!state->isMessage)
00490 op << "static_cast<" << *state->type << "*>(buf" << offset << "->cl)";
00491 else
00492 op << "static_cast<" << *state->type << "*>(static_cast<SDAG::MsgClosure*>(buf"
00493 << offset << "->cl)->msg)";
00494 } else {
00495 if (state->name)
00496 op << *state->name;
00497 else
00498 op << "gen" << cur;
00499 }
00500 } else {
00501 fprintf(stderr, "type was not propagated to this phase");
00502 exit(120);
00503 }
00504
00505 if (cur != next.size() - 1) op << ", ";
00506 }
00507
00508 op << ");\n";
00509 }
00510
00511
00512
00513 void SdagConstruct::setNext(SdagConstruct* n, int boe) {
00514 switch (type) {
00515 case SSLIST:
00516 next = n;
00517 nextBeginOrEnd = boe;
00518 {
00519 if (constructs->empty()) return;
00520
00521 list<SdagConstruct*>::iterator it = constructs->begin();
00522 SdagConstruct* cn = *it;
00523 ++it;
00524
00525 for (; it != constructs->end(); ++it) {
00526 cn->setNext(*it, 1);
00527 cn = *it;
00528 }
00529 cn->setNext(this, 0);
00530 }
00531 return;
00532 case SCASELIST:
00533 next = n;
00534 nextBeginOrEnd = boe;
00535 {
00536 for (list<SdagConstruct*>::iterator it = constructs->begin();
00537 it != constructs->end(); ++it) {
00538 (*it)->setNext(this, 0);
00539 }
00540 }
00541 return;
00542 case SCASE:
00543 case SSDAGENTRY:
00544 case SOVERLAP:
00545 case SOLIST:
00546 case SFORALL:
00547 case SWHEN:
00548 case SFOR:
00549 case SWHILE:
00550 case SSERIAL:
00551 case SELSE:
00552 next = n;
00553 nextBeginOrEnd = boe;
00554 n = this;
00555 boe = 0;
00556 break;
00557 case SIF:
00558 next = n;
00559 nextBeginOrEnd = boe;
00560 if (con2 != 0) con2->setNext(n, boe);
00561 n = this;
00562 boe = 0;
00563 break;
00564 default:
00565 break;
00566 }
00567 SdagConstruct* cn;
00568 if (constructs != 0) {
00569 for (list<SdagConstruct*>::iterator it = constructs->begin(); it != constructs->end();
00570 ++it) {
00571 (*it)->setNext(n, boe);
00572 }
00573 }
00574 }
00575
00576
00577 void SdagConstruct::generateTrace() {
00578 for_each(constructs->begin(), constructs->end(),
00579 #if __cplusplus < 201103L
00580 mem_fun(&SdagConstruct::generateTrace));
00581 #else
00582 [](SdagConstruct * c) { c->generateTrace(); } );
00583 #endif
00584 if (con1) con1->generateTrace();
00585 if (con2) con2->generateTrace();
00586 if (con3) con3->generateTrace();
00587 }
00588
00589 void SdagConstruct::generateTraceBeginCall(XStr& op, int indent) {
00590 if (traceName) {
00591 indentBy(op, indent);
00592 op << "_TRACE_BEGIN_EXECUTE_DETAILED(-1, -1, ("
00593 << "_sdag_idx_" << traceName << "()), CkMyPe(), 0, ";
00594
00595 if (entry->getContainer()->isArray())
00596 op << "ckGetArrayIndex().getProjectionID()";
00597 else
00598 op << "NULL";
00599
00600 op << ", this); \n";
00601 }
00602 }
00603
00604 void SdagConstruct::generateDummyBeginExecute(XStr& op, int indent, Entry* entry) {
00605 indentBy(op, indent);
00606 op << "_TRACE_BEGIN_EXECUTE_DETAILED(-1, -1, _sdagEP, CkMyPe(), 0, ";
00607
00608 if (entry->getContainer()->isArray())
00609 op << "ckGetArrayIndex().getProjectionID()";
00610 else
00611 op << "NULL";
00612
00613 op << ", this); \n";
00614 }
00615
00616 void SdagConstruct::generateTraceEndCall(XStr& op, int indent) {
00617 indentBy(op, indent);
00618 op << "_TRACE_END_EXECUTE(); \n";
00619 }
00620
00621 void SdagConstruct::generateBeginExec(XStr& op, const char* name) {
00622 op << " "
00623 << "_TRACE_BG_BEGIN_EXECUTE_NOMSG(\"" << name << "\", &_bgParentLog,1);\n";
00624 }
00625
00626 void SdagConstruct::generateEndExec(XStr& op) {
00627 op << " "
00628 << "_TRACE_BG_END_EXECUTE(0);\n";
00629 }
00630
00631 void SdagConstruct::generateBeginTime(XStr& op) {
00632
00633 op << " double __begintime = CkVTimer(); \n";
00634 }
00635
00636 void SdagConstruct::generateTlineEndCall(XStr& op) {
00637
00638 op << " _TRACE_BG_TLINE_END(&_bgParentLog);\n";
00639 }
00640
00641 void SdagConstruct::generateEndSeq(XStr& op) {
00642 op << " void* _bgParentLog = NULL;\n";
00643 op << " CkElapse(0.01e-6);\n";
00644
00645 generateTlineEndCall(op);
00646 generateTraceEndCall(op, 1);
00647 generateEndExec(op);
00648 }
00649
00650 void SdagConstruct::generateEventBracket(XStr& op, int eventType) {
00651 (void)eventType;
00652
00653 op << " _TRACE_BG_USER_EVENT_BRACKET(\"" << nameStr
00654 << "\", __begintime, CkVTimer(), &_bgParentLog); \n";
00655 }
00656
00657 void SdagConstruct::generateListEventBracket(XStr& op, int eventType) {
00658 (void)eventType;
00659 op << " _TRACE_BGLIST_USER_EVENT_BRACKET(\"" << nameStr
00660 << "\", __begintime,CkVTimer(), &_bgParentLog, " << label << "_bgLogList);\n";
00661 }
00662
00663 void SdagConstruct::generateRegisterEp(XStr& defs) {
00664 if (traceName) defs << " (void)_sdag_idx_" << traceName << "();\n";
00665
00666 for (list<SdagConstruct*>::iterator iter = constructs->begin();
00667 iter != constructs->end(); ++iter)
00668 (*iter)->generateRegisterEp(defs);
00669 if (con1) con1->generateRegisterEp(defs);
00670 if (con2) con2->generateRegisterEp(defs);
00671 if (con3) con3->generateRegisterEp(defs);
00672 }
00673
00674 void SdagConstruct::generateTraceEp(XStr& decls, XStr& defs, Chare* chare) {
00675 if (traceName) {
00676 XStr regName, idxName;
00677
00678 idxName << "_sdag_idx_" << traceName;
00679 regName << "_sdag_reg_" << traceName;
00680 generateVarSignature(decls, defs, chare, true, "int", &idxName, false, NULL);
00681 defs << " static int epidx = " << regName << "();\n"
00682 << " return epidx;\n";
00683 endMethod(defs);
00684
00685 generateVarSignature(decls, defs, chare, true, "int", ®Name, false, NULL);
00686 defs << " return CkRegisterEp(\"" << traceName << "\", NULL, 0, "
00687 << chare->indexName() << "::__idx, 0"
00688 << ");\n";
00689 endMethod(defs);
00690 }
00691
00692 for (list<SdagConstruct*>::iterator it = constructs->begin(); it != constructs->end();
00693 ++it) {
00694 (*it)->generateTraceEp(decls, defs, chare);
00695 }
00696 if (con1) con1->generateTraceEp(decls, defs, chare);
00697 if (con2) con2->generateTraceEp(decls, defs, chare);
00698 if (con3) con3->generateTraceEp(decls, defs, chare);
00699 }
00700 }