Esempio n. 1
0
File: block.c Progetto: Ced/cloog
/**
 * cloog_block_free function:
 * This function frees the allocated memory for a CloogStatement structure.
 * - June 11th 2005: first version.
 * - June 30th 2005: scaldims field management.
 */
void cloog_block_free(CloogBlock * block)
{ int i ;

  if (block != NULL)
  { block->references -- ;
    
    if (block->references == 0) {
      cloog_block_leak_down(block->state);
      if (block->scaldims != NULL)
      { for (i=0;i<block->nb_scaldims;i++)
	  cloog_int_clear(block->scaldims[i]);
      
        free(block->scaldims) ;
      }
      if (block->statement)
	cloog_statement_free(block->statement);
      free(block) ;
    }
  }
}
Esempio n. 2
0
/**
 * cloog_block_merge function:
 * this function adds at the end of the statement list of the block 'block',
 * the statement list of the block 'merged'. Then the  CloogBlock structure
 * of 'merged' is freed (obviously not its statement list that is now
 * included in 'block').
 * - June 11th 2005: first version.
 */
void cloog_block_merge(CloogBlock * block, CloogBlock * merged)
{ CloogStatement * statement ;

  if ((block == NULL) || (merged == NULL))
  return ;
  
  if (cloog_block_stmt (block))
    {
      statement = cloog_block_stmt (block) ;
    
      while (cloog_statement_next (statement))
	statement = cloog_statement_next (statement) ;
    
      cloog_statement_set_next (statement, cloog_block_stmt (merged));
    }
  else
    cloog_block_set_stmt (block, cloog_block_stmt (merged));

  cloog_block_leak_down() ;
  free(merged) ;
}
Esempio n. 3
0
/**
 * cloog_block_free function:
 * This function frees the allocated memory for a CloogStatement structure.
 * - June 11th 2005: first version.
 * - June 30th 2005: scaldims field management.
 */
void cloog_block_free(CloogBlock * block)
{ int i ;

  if (block != NULL)
    {
      cloog_block_dec_references (block);
    
      if (cloog_block_references (block) == 0)
	{ cloog_block_leak_down() ;
	  if (cloog_block_scaldims (block))
	    {
	      for (i = 0; i < cloog_block_nb_scaldims (block); i++)
		value_clear_c (block->scaldims[i]);
      
	      free (cloog_block_scaldims (block)) ;
	    }
	  cloog_statement_free(cloog_block_stmt (block)) ;
	  free(block) ;
	}
    }
}