Пример #1
0
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;
}
Пример #2
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;
}