void runPasses(PhaseTracker& tracker, bool isChpldoc) { size_t passListSize = sizeof(sPassList) / sizeof(sPassList[0]); setupLogfiles(); if (printPasses == true || printPassesFile != 0) { tracker.ReportPass(); } for (size_t i = 0; i < passListSize; i++) { runPass(tracker, i); USR_STOP(); // quit if fatal errors were encountered in pass currentPassNo++; // Break early if this is a chpl doc run if (isChpldoc == true && strcmp(sPassList[i].name, "docs") == 0) { break; } } destroyAst(); teardownLogfiles(); }
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(); } }
int main(int argc, char* argv[]) { PhaseTracker tracker; startCatchingSignals(); { astlocMarker markAstLoc(0, "<internal>"); tracker.StartPhase("init"); init_args(&sArgState, argv[0]); fDocs = (strcmp(sArgState.program_name, "chpldoc") == 0) ? true : false; fUseIPE = (strcmp(sArgState.program_name, "chpl-ipe") == 0) ? true : false; // Initialize the arguments for argument state. If chpldoc, use the docs // specific arguments. Otherwise, use the regular arguments. if (fDocs) { init_arg_desc(&sArgState, docs_arg_desc); } else { init_arg_desc(&sArgState, arg_desc); } initFlags(); initRootModule(); initPrimitive(); initPrimitiveTypes(); DefExpr* objectClass = defineObjectClass(); initChplProgram(objectClass); initStringLiteralModule(); process_args(&sArgState, argc, argv); setupChplGlobals(argv[0]); postprocess_args(); initCompilerGlobals(); // must follow argument parsing setupModulePaths(); recordCodeGenStrings(argc, argv); } // astlocMarker scope if (fUseIPE == false) printStuff(argv[0]); if (fRungdb) runCompilerInGDB(argc, argv); if (fRunlldb) runCompilerInLLDB(argc, argv); addSourceFiles(sArgState.nfile_arguments, sArgState.file_argument); if (fUseIPE == false) { runPasses(tracker, fDocs); } else { ipeRun(); } tracker.StartPhase("driverCleanup"); free_args(&sArgState); tracker.Stop(); if (printPasses == true || printPassesFile != NULL) { tracker.ReportPass(); tracker.ReportTotal(); tracker.ReportRollup(); } if (printPassesFile != NULL) { fclose(printPassesFile); } clean_exit(0); return 0; }
int main(int argc, char* argv[]) { PhaseTracker tracker; startCatchingSignals(); { astlocMarker markAstLoc(0, "<internal>"); tracker.StartPhase("init"); initFlags(); initChplProgram(); initPrimitive(); initPrimitiveTypes(); initTheProgram(); setupOrderedGlobals(argv[0]); compute_program_name_loc(argv[0], &(arg_state.program_name), &(arg_state.program_loc)); process_args(&arg_state, argc, argv); initCompilerGlobals(); // must follow argument parsing setupDependentVars(); setupModulePaths(); recordCodeGenStrings(argc, argv); } // astlocMarker scope printStuff(argv[0]); if (rungdb) runCompilerInGDB(argc, argv); if (runlldb) runCompilerInLLDB(argc, argv); testInputFiles(arg_state.nfile_arguments, arg_state.file_argument); if (strcmp(chplBinaryName, "chpldoc") == 0) fDocs = true; runPasses(tracker); tracker.StartPhase("driverCleanup"); if (fEnableTimers) { printf("timer 1: %8.3lf\n", timer1.elapsedSecs()); printf("timer 2: %8.3lf\n", timer2.elapsedSecs()); printf("timer 3: %8.3lf\n", timer3.elapsedSecs()); printf("timer 4: %8.3lf\n", timer4.elapsedSecs()); printf("timer 5: %8.3lf\n", timer5.elapsedSecs()); } free_args(&arg_state); tracker.Stop(); if (printPasses == true || printPassesFile != NULL) { tracker.ReportPass(); tracker.ReportTotal(); tracker.ReportRollup(); } if (printPassesFile != NULL) { fclose(printPassesFile); } clean_exit(0); return 0; }