static void runPass(const char *passName, void (*pass)(void), void (*check)(), char log_tag) { static struct timeval startTimeBetweenPasses; static struct timeval stopTimeBetweenPasses; static double timeBetweenPasses = -1.0; static double totalTime = 0.0; struct timeval startTime; struct timeval stopTime; struct timezone timezone; static bool performTiming = printPasses || (printPassesFile != NULL); if (performTiming) { gettimeofday(&stopTimeBetweenPasses, &timezone); if (timeBetweenPasses < 0.0) timeBetweenPasses = 0.0; else timeBetweenPasses += ((double)((stopTimeBetweenPasses.tv_sec*1e6+ stopTimeBetweenPasses.tv_usec) - (startTimeBetweenPasses.tv_sec*1e6+ startTimeBetweenPasses.tv_usec))) / 1e6; } if (strlen(fPrintStatistics) && strcmp(passName, "parse")) printStatistics("clean"); if (performTiming) { printPassTiming("%32s :", passName); gettimeofday(&startTime, &timezone); } (*pass)(); if (performTiming) { gettimeofday(&stopTime, &timezone); printPassTiming("%8.3f seconds", ((double)((stopTime.tv_sec*1e6+stopTime.tv_usec) - (startTime.tv_sec*1e6+startTime.tv_usec))) / 1e6); if (developer && printPasses) fprintf(stderr, " [%d]", lastNodeIDUsed()); printPassTiming("\n"); totalTime += ((double)((stopTime.tv_sec*1e6+stopTime.tv_usec) - (startTime.tv_sec*1e6+startTime.tv_usec))) / 1e6; if (!strcmp(passName, "makeBinary")) { printPassTiming("%32s :%8.3f seconds\n", "time between passes", timeBetweenPasses); printPassTiming("%32s :%8.3f seconds\n", "total time", totalTime+timeBetweenPasses); } } if (strlen(fPrintStatistics)) printStatistics(passName); if (fdump_html) { html_view(passName); } if (logging(log_tag)) dump_ast(passName, currentPassNo); if (performTiming) { gettimeofday(&startTimeBetweenPasses, &timezone); } considerExitingEndOfPass(); cleanAst(); (*check)(); // Run per-pass check function. //printPrimitiveCounts(passName); }
static void runPass(PhaseTracker& tracker, size_t passIndex, bool isChpldoc) { PassInfo* info = &sPassList[passIndex]; // // The primary work for this pass // tracker.StartPhase(info->name, PhaseTracker::kPrimary); if (fPrintStatistics[0] != '\0' && passIndex > 0) printStatistics("clean"); (*(info->passFunction))(); // // Statistics and logging // if (fPrintStatistics[0] != '\0') printStatistics(info->name); log_writeLog(info->name, currentPassNo, info->logTag); considerExitingEndOfPass(); // // Clean up the global pointers to AST. If we're running chpldoc, // there's no real reason to run this step (and at the time of this // writing, it didn't work if we hadn't parsed all the 'use'd // modules. // if (!isChpldoc) { tracker.StartPhase(info->name, PhaseTracker::kCleanAst); cleanAst(); } // // An optional verify pass // tracker.StartPhase(info->name, PhaseTracker::kVerify); (*(info->checkFunction))(); // Run per-pass check function. if (printPasses == true || printPassesFile != 0) { tracker.ReportPass(); } }
static void runPass(PhaseTracker& tracker, size_t passIndex) { PassInfo* info = &sPassList[passIndex]; // // The primary work for this pass // tracker.StartPhase(info->name, PhaseTracker::kPrimary); if (fPrintStatistics[0] != '\0' && passIndex > 0) printStatistics("clean"); (*(info->passFunction))(); // // Statistics and logging // if (fPrintStatistics[0] != '\0') printStatistics(info->name); log_writeLog(info->name, currentPassNo, info->logTag); considerExitingEndOfPass(); // // Clean up the global pointers to AST // tracker.StartPhase(info->name, PhaseTracker::kCleanAst); cleanAst(); // // An optional verify pass // tracker.StartPhase(info->name, PhaseTracker::kVerify); (*(info->checkFunction))(); // Run per-pass check function. if (printPasses == true || printPassesFile != 0) { tracker.ReportPass(); } }