summaryrefslogtreecommitdiffstats
path: root/src/opt
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2011-03-27 14:17:12 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2011-03-27 14:17:12 -0700
commit6c01e8b9f040d591f72882aff08ed21446fbb567 (patch)
tree71f04dae22291d7321e5bb244462ab1145c47ee6 /src/opt
parent1ec437d04b2fcb42054f068525c2a1b21b69fe53 (diff)
downloadabc-6c01e8b9f040d591f72882aff08ed21446fbb567.tar.gz
abc-6c01e8b9f040d591f72882aff08ed21446fbb567.tar.bz2
abc-6c01e8b9f040d591f72882aff08ed21446fbb567.zip
Fixed a number of small bugs and memory leaks.
Diffstat (limited to 'src/opt')
-rw-r--r--src/opt/cut/cutOracle.c5
-rw-r--r--src/opt/fxu/fxuInt.h5
-rw-r--r--src/opt/fxu/fxuReduce.c8
-rw-r--r--src/opt/fxu/fxuSelect.c10
-rw-r--r--src/opt/ret/retLvalue.c1
5 files changed, 14 insertions, 15 deletions
diff --git a/src/opt/cut/cutOracle.c b/src/opt/cut/cutOracle.c
index f7883e3f..b26e7d5e 100644
--- a/src/opt/cut/cutOracle.c
+++ b/src/opt/cut/cutOracle.c
@@ -126,9 +126,6 @@ Cut_Oracle_t * Cut_OracleStart( Cut_Man_t * pMan )
***********************************************************************/
void Cut_OracleStop( Cut_Oracle_t * p )
{
- Cut_Cut_t * pCut;
- int i;
-
// if ( p->pParams->fVerbose )
{
printf( "Cut computation statistics with oracle:\n" );
@@ -136,8 +133,6 @@ void Cut_OracleStop( Cut_Oracle_t * p )
ABC_PRT( "Total time ", p->timeTotal );
}
- Vec_PtrForEachEntry( Cut_Cut_t *, p->vCutsNew, pCut, i )
-
if ( p->vCuts0 ) Vec_PtrFree( p->vCuts0 );
if ( p->vCuts1 ) Vec_PtrFree( p->vCuts1 );
if ( p->vCutsNew ) Vec_PtrFree( p->vCutsNew );
diff --git a/src/opt/fxu/fxuInt.h b/src/opt/fxu/fxuInt.h
index bbceac47..402b7cdd 100644
--- a/src/opt/fxu/fxuInt.h
+++ b/src/opt/fxu/fxuInt.h
@@ -368,10 +368,9 @@ struct FxuSingle // 7 words
// iterator through the cube pairs belonging to the given cube
#define Fxu_CubeForEachPair( pCube, pPair, i )\
for ( i = 0;\
- i < pCube->pVar->nCubes &&\
- (((unsigned)(ABC_PTRUINT_T)(pPair = pCube->pVar->ppPairs[pCube->iCube][i])) >= 0);\
+ i < pCube->pVar->nCubes && (((pPair) = (pCube)->pVar->ppPairs[(pCube)->iCube][i]), 1);\
i++ )\
- if ( pPair )
+ if ( pPair == NULL ) {} else
// iterator through all the items in the heap
#define Fxu_HeapDoubleForEachItem( Heap, Div )\
diff --git a/src/opt/fxu/fxuReduce.c b/src/opt/fxu/fxuReduce.c
index 2321ec57..b0e3e4a7 100644
--- a/src/opt/fxu/fxuReduce.c
+++ b/src/opt/fxu/fxuReduce.c
@@ -67,7 +67,7 @@ int Fxu_PreprocessCubePairs( Fxu_Matrix * p, Vec_Ptr_t * vCovers, int nPairsTota
assert( nPairsMax < nPairsTotal );
// allocate storage for counter of diffs
- pnLitsDiff = ABC_ALLOC( unsigned char, nPairsTotal );
+ pnLitsDiff = ABC_FALLOC( unsigned char, nPairsTotal );
// go through the covers and precompute the distances between the pairs
iPair = 0;
nBitsMax = -1;
@@ -86,7 +86,7 @@ int Fxu_PreprocessCubePairs( Fxu_Matrix * p, Vec_Ptr_t * vCovers, int nPairsTota
assert( iPair == nPairsTotal );
// allocate storage for counters of cube pairs by difference
- pnPairCounters = ABC_ALLOC( int, 2 * nBitsMax );
+ pnPairCounters = ABC_FALLOC( int, 2 * nBitsMax );
memset( pnPairCounters, 0, sizeof(int) * 2 * nBitsMax );
// count the number of different pairs
for ( k = 0; k < nPairsTotal; k++ )
@@ -95,11 +95,15 @@ int Fxu_PreprocessCubePairs( Fxu_Matrix * p, Vec_Ptr_t * vCovers, int nPairsTota
// so that there would be exactly pPairsMax pairs
if ( pnPairCounters[0] != 0 )
{
+ ABC_FREE( pnLitsDiff );
+ ABC_FREE( pnPairCounters );
printf( "The SOPs of the nodes are not cube-ABC_FREE. Run \"bdd; sop\" before \"fx\".\n" );
return 0;
}
if ( pnPairCounters[1] != 0 )
{
+ ABC_FREE( pnLitsDiff );
+ ABC_FREE( pnPairCounters );
printf( "The SOPs of the nodes are not SCC-ABC_FREE. Run \"bdd; sop\" before \"fx\".\n" );
return 0;
}
diff --git a/src/opt/fxu/fxuSelect.c b/src/opt/fxu/fxuSelect.c
index a4e260c7..c9945926 100644
--- a/src/opt/fxu/fxuSelect.c
+++ b/src/opt/fxu/fxuSelect.c
@@ -57,12 +57,12 @@ void Fxu_MatrixGetDoubleVars( Fxu_Matrix * p, Fxu_Double * pDouble,
int Fxu_Select( Fxu_Matrix * p, Fxu_Single ** ppSingle, Fxu_Double ** ppDouble )
{
// the top entries
- Fxu_Single * pSingles[MAX_SIZE_LOOKAHEAD];
- Fxu_Double * pDoubles[MAX_SIZE_LOOKAHEAD];
+ Fxu_Single * pSingles[MAX_SIZE_LOOKAHEAD] = {0};
+ Fxu_Double * pDoubles[MAX_SIZE_LOOKAHEAD] = {0};
// the complements
- Fxu_Double * pSCompl[MAX_SIZE_LOOKAHEAD];
- Fxu_Single * pDComplS[MAX_SIZE_LOOKAHEAD];
- Fxu_Double * pDComplD[MAX_SIZE_LOOKAHEAD];
+ Fxu_Double * pSCompl[MAX_SIZE_LOOKAHEAD] = {0};
+ Fxu_Single * pDComplS[MAX_SIZE_LOOKAHEAD] = {0};
+ Fxu_Double * pDComplD[MAX_SIZE_LOOKAHEAD] = {0};
Fxu_Pair * pPair;
int nSingles;
int nDoubles;
diff --git a/src/opt/ret/retLvalue.c b/src/opt/ret/retLvalue.c
index 7d32dd7d..95569867 100644
--- a/src/opt/ret/retLvalue.c
+++ b/src/opt/ret/retLvalue.c
@@ -104,6 +104,7 @@ Vec_Int_t * Abc_NtkRetimeGetLags( Abc_Ntk_t * pNtk, int nIterLimit, int fVerbose
vLatches = Abc_ManCollectLatches( pNtk );
if ( !Abc_NtkRetimeForPeriod( pNtk, vNodes, vLatches, FiMax, nIterLimit, fVerbose ) )
{
+ Vec_PtrFree( vLatches );
Vec_PtrFree( vNodes );
printf( "Abc_NtkRetimeGetLags() error: The upper bound on the clock period cannot be computed.\n" );
return Vec_IntStart( Abc_NtkObjNumMax(pNtk) + 1 );