Пример #1
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);
}
Пример #2
0
/** <!--**********************************************************************-->
 *
 * @fn node *CHKinsertError( node *arg_node, char *string)
 *******************************************************************************/
node *CHKinsertError( node *arg_node, char *string)
{
  DBUG_ENTER( "CHKinsertError");

  if ( arg_node == NULL) {
    
    CTIwarn( "%s", string);

    arg_node = TBmakeError( STRcpy( string), global.compiler_anyphase, arg_node);
  } 
  else {
    if ( !(STReq( string, ERROR_MESSAGE( arg_node)))) {
      ERROR_NEXT( arg_node) = CHKinsertError( ERROR_NEXT( arg_node), string);
    }
    else {
      ERROR_ANYPHASE( arg_node) = global.compiler_anyphase;
    }
  } 
  
  DBUG_RETURN( arg_node);
}