OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [cuc/] [cuc.c] - Diff between revs 934 and 936

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 934 Rev 936
Line 54... Line 54...
 
 
/* Does all known instruction optimizations */
/* Does all known instruction optimizations */
void cuc_optimize (cuc_func *func)
void cuc_optimize (cuc_func *func)
{
{
  int modified = 0;
  int modified = 0;
 
  int first = 1;
  log ("Optimizing.\n");
  log ("Optimizing.\n");
  do {
  do {
    modified = 0;
    modified = 0;
    if (optimize_cmovs (func)) {
    if (optimize_cmovs (func)) {
      if (cuc_debug >= 6) print_cuc_bb (func, "AFTER_OPT_CMOVS");
      if (cuc_debug >= 6) print_cuc_bb (func, "AFTER_OPT_CMOVS");
Line 81... Line 82...
    if (cse (func)) {
    if (cse (func)) {
      log ("Common subexpression elimination.\n");
      log ("Common subexpression elimination.\n");
      if (cuc_debug >= 3) print_cuc_bb (func, "AFTER_CSE");
      if (cuc_debug >= 3) print_cuc_bb (func, "AFTER_CSE");
      modified = 1;
      modified = 1;
    }
    }
 
    if (first) {
 
      insert_conditional_facts (func);
 
      if (cuc_debug >= 3) print_cuc_bb (func, "AFTER_COND_FACT");
    if (cuc_debug) cuc_check (func);
    if (cuc_debug) cuc_check (func);
 
      first = 0;
 
    }
    if (optimize_bb (func)) {
    if (optimize_bb (func)) {
      if (cuc_debug >= 5) print_cuc_bb (func, "AFTER_OPT_BB");
      if (cuc_debug >= 5) print_cuc_bb (func, "AFTER_OPT_BB");
      modified = 1;
      modified = 1;
    }
    }
    if (cuc_debug) cuc_check (func);
    if (cuc_debug) cuc_check (func);
Line 105... Line 111...
      if (cuc_debug >= 6) print_cuc_bb (func, "NO_NOPS");
      if (cuc_debug >= 6) print_cuc_bb (func, "NO_NOPS");
      modified = 1;
      modified = 1;
    }
    }
  } while (modified);
  } while (modified);
  set_io (func);
  set_io (func);
 
  detect_max_values (func);
 
  if (cuc_debug >= 5) print_cuc_bb (func, "AFTER_MAX_VALUES");
}
}
 
 
/* Pre/unrolls basic block and optimizes it */
/* Pre/unrolls basic block and optimizes it */
cuc_timings *preunroll_bb (char *bb_filename, cuc_func *f, cuc_timings *timings, int b, int i, int j)
cuc_timings *preunroll_bb (char *bb_filename, cuc_func *f, cuc_timings *timings, int b, int i, int j)
{
{
Line 190... Line 198...
  reg_dep (func);
  reg_dep (func);
 
 
  log ("Detecting dependencies\n");
  log ("Detecting dependencies\n");
  if (cuc_debug >= 2) print_cuc_bb (func, "AFTER_REG_DEP");
  if (cuc_debug >= 2) print_cuc_bb (func, "AFTER_REG_DEP");
  cuc_optimize (func);
  cuc_optimize (func);
  if (cuc_debug) cuc_check (func);
 
  insert_conditional_facts (func);
 
  if (cuc_debug >= 3) print_cuc_bb (func, "AFTER_COND_FACT");
 
  if (cuc_debug) cuc_check (func);
 
  cuc_optimize (func);
 
 
 
#if 0
#if 0
  csm (func);
  csm (func);
#endif
#endif
  assert (saved = dup_func (func));
  assert (saved = dup_func (func));

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.