Modified the cell copy routine so that it does not attempt to

guarantee unique instance names during generation of each new
copy, but only afterward, in bulk.  Otherwise the copy routine
has a runtime that is exponential with the number of cells being
copied.  This and the last commit guarantee that the "flatten
-novendor" option works as advertised.
This commit is contained in:
Tim Edwards 2022-09-07 17:02:36 -04:00
parent 4087ac2dba
commit 84b429792d
2 changed files with 19 additions and 11 deletions

View File

@ -1209,6 +1209,10 @@ DBCellCopyAllCells(scx, xMask, targetUse, pArea)
GeoTransRect(&scx->scx_trans, &scx->scx_area, &arg.caa_rect);
(void) DBTreeSrCells(scx, xMask, dbCellCopyCellsFunc, (ClientData) &arg);
/* dbCellCopyCellsFunc() allows cells to be left with duplicate IDs */
/* so generate unique IDs as needed now. */
DBGenerateUniqueIds(targetUse->cu_def, FALSE);
}
/*
@ -1306,17 +1310,12 @@ dbCellCopyCellsFunc(scx, arg)
return 2;
}
/* When creating a new use, try to re-use the id from the old
* one. Only create a new one if the old id can't be used.
*/
/* When creating a new use, re-use the id from the old one. */
/* Do not attempt to run DBLinkCell() now and resolve unique IDs; */
/* just create duplicate IDs and regenerate unique ones at the end. */
newUse = DBCellNewUse(def, (char *) use->cu_id);
if (!DBLinkCell(newUse, arg->caa_targetUse->cu_def))
{
freeMagic((char *) newUse->cu_id);
newUse->cu_id = NULL;
(void) DBLinkCell(newUse, arg->caa_targetUse->cu_def);
}
newUse->cu_expandMask = use->cu_expandMask;
newUse->cu_flags = use->cu_flags;

View File

@ -2098,6 +2098,14 @@ DBCellSrDefs(pattern, func, cdata)
* This operation is not recorded on the undo list, as it always accompanies
* the creation of a new cell use.
*
* *** ANOTHER WARNING ***
*
* Do NOT pass a NULL cu_id to this routine when doing bulk cell copies,
* because an entire hash table of entries for the parent def will be created
* and searched for every cell being linked, making the routine run-time
* exponential with the number of links. It is better to run
* DBGenerateUniqueIDs() instead.
*
* Results:
* TRUE if the CellUse is unique within the parent CellDef, FALSE
* if there would be a name conflict. If the cu_id of the CellUse
@ -2363,8 +2371,9 @@ dbFindNamesFunc(use, parentDef)
he = HashFind(&dbUniqueNameTable, use->cu_id);
if (HashGetValue(he))
{
TxError("Duplicate instance-id for cell %s (%s) will be renamed\n",
use->cu_def->cd_name, use->cu_id);
if (dbWarnUniqueIds)
TxError("Duplicate instance-id for cell %s (%s) will be renamed\n",
use->cu_def->cd_name, use->cu_id);
DBUnLinkCell(use, parentDef);
freeMagic(use->cu_id);
use->cu_id = (char *) NULL;