Exemple #1
0
node *PHrunSubPhase( compiler_phase_t subphase, node *syntax_tree, bool cond)
{
  DBUG_ENTER("PHrunSubPhase");

  DBUG_ASSERTF( PHIphaseType( subphase) == PHT_subphase,
                ("PHrunSubPhase called with incompatible phase: %s",
                 PHIphaseIdent( subphase)));
  
  global.compiler_subphase = subphase;
  global.compiler_anyphase = subphase;

  CheckEnableDbug( subphase);

  if (cond) {
    if (PHIphaseType( subphase) != PHT_cycle) {
      CTInote("**** %s ...", PHIphaseText( subphase));
    }
    syntax_tree = PHIphaseFun( subphase)( syntax_tree);
    CTIabortOnError();

    if (global.treecheck && (syntax_tree != NULL)) {
      syntax_tree = CHKdoTreeCheck( syntax_tree);
    }
  }
  
  CTIabortOnError();

  CheckDisableDbug( subphase);

  if ( global.break_after_subphase == subphase ) {
    CTIterminateCompilation( syntax_tree);
  }
  
  DBUG_RETURN( syntax_tree);
}
Exemple #2
0
node *PHrunCyclePhase( compiler_phase_t cyclephase,
                       node *syntax_tree, bool cond)
{
  DBUG_ENTER("PHrunCyclePhase");

  DBUG_ASSERTF( PHIphaseType( cyclephase) == PHT_cyclephase,
                ("PHrunPhase called with incompatible phase: %s",
                 PHIphaseIdent( cyclephase)));
  
  global.compiler_cyclephase = cyclephase;
  global.compiler_anyphase = cyclephase;

  CheckEnableDbug( cyclephase);

  if (cond && ((cyclephase <= global.break_after_cyclephase)
               || (global.cycle_counter < global.break_cycle_specifier))) {
    CTInote( "****** %s ...", PHIphaseText( cyclephase));
    
    syntax_tree = PHIphaseFun( cyclephase)( syntax_tree);

    CTIabortOnError();

    if (global.treecheck && (syntax_tree != NULL)) {
      syntax_tree = CHKdoTreeCheck( syntax_tree);
    }
  }
  
  CheckDisableDbug( cyclephase);

  DBUG_RETURN( syntax_tree);
}
Exemple #3
0
node *PHrunCycle( compiler_phase_t cycle, node *syntax_tree, bool cond, bool reset)
{
  DBUG_ENTER("PHrunCycle");
  
  DBUG_ASSERTF( PHIphaseType( cycle) == PHT_cycle,
                ("PHrunCycle called with incompatible phase: %s",
                 PHIphaseIdent( cycle)));
  
  global.compiler_subphase = cycle;
  global.compiler_anyphase = cycle;

  if (cond) {
    CheckEnableDbug( cycle);
    global.cycle_counter = 1;

    do  { 
      CTInote(" ");
      CTInote("**** %s pass: %i", PHIphaseText( cycle), global.cycle_counter);

      go_one_cycle_more = FALSE;

      syntax_tree = PHIphaseFun( cycle)( syntax_tree);

      CTIabortOnError();
      
      if (global.treecheck && (syntax_tree != NULL)) {
        syntax_tree = CHKdoTreeCheck( syntax_tree);
      }

      if (!go_one_cycle_more) {
        CTInote(" "); 
      } 

      global.cycle_counter += 1;

    } while ( go_one_cycle_more
              && (global.cycle_counter <= global.max_optcycles) 
              && ((global.cycle_counter <= global.break_cycle_specifier) 
                  || (global.break_after_cyclephase > global.compiler_cyclephase ))); 

    if (go_one_cycle_more && (global.cycle_counter == global.max_optcycles)) { 
      CTIwarn( "Maximum number of optimization cycles reached");  
    } 

    CheckDisableDbug( cycle);
  }

  CTIabortOnError();

  if ( global.break_after_subphase == cycle ) {
    CTIterminateCompilation( syntax_tree);
  }
  
  DBUG_RETURN( syntax_tree);
}
Exemple #4
0
node *PHrunPhase( compiler_phase_t phase, node *syntax_tree, bool cond)
{
  static int phase_num=0;
  
  DBUG_ENTER("PHrunPhase");
  
  DBUG_ASSERTF( PHIphaseType( phase) == PHT_phase,
                ("PHrunPhase called with incompatible phase: %s",
                 PHIphaseIdent( phase)));
  
  global.compiler_phase = phase;
  global.compiler_anyphase = phase;
  phase_num += 1;
  CheckEnableDbug( phase);

  CTInote(" ");

  if (cond) {
    CTIstate("** %2d: %s ...", phase_num, PHIphaseText( phase));
    syntax_tree = PHIphaseFun( phase)( syntax_tree);

    CTIabortOnError();

    if (global.treecheck && (syntax_tree != NULL)) {
      syntax_tree = CHKdoTreeCheck( syntax_tree);
    }
  }
  else {
    CTIstate("** %2d: %s skipped.", phase_num, PHIphaseText( phase));
  }
    
  CheckDisableDbug( phase);

  CTIabortOnError();

  if (global.break_after_phase == phase) {
    PRTdoPrint( syntax_tree);
    CTIterminateCompilation( syntax_tree);
  }
  
  DBUG_RETURN( syntax_tree);
}