@@ -154,7 +154,7 @@ void free_arch(t_arch* arch) {
154154
155155 for (int i = 0 ; i < arch->num_switches ; ++i) {
156156 if (arch->Switches ->name != nullptr ) {
157- delete arch->Switches [i].name ;
157+ vtr::free ( arch->Switches [i].name ) ;
158158 }
159159 }
160160 delete[] arch->Switches ;
@@ -163,13 +163,13 @@ void free_arch(t_arch* arch) {
163163 free_arch_models (arch->models );
164164
165165 for (int i = 0 ; i < arch->num_directs ; ++i) {
166- delete arch->Directs [i].name ;
167- delete arch->Directs [i].from_pin ;
168- delete arch->Directs [i].to_pin ;
166+ vtr::free ( arch->Directs [i].name ) ;
167+ vtr::free ( arch->Directs [i].from_pin ) ;
168+ vtr::free ( arch->Directs [i].to_pin ) ;
169169 }
170- delete arch->Directs ;
170+ vtr::free ( arch->Directs ) ;
171171
172- delete arch->architecture_id ;
172+ vtr::free ( arch->architecture_id ) ;
173173
174174 // Free internal model library
175175 if (arch->model_library ) {
@@ -178,50 +178,50 @@ void free_arch(t_arch* arch) {
178178 while (vptr) {
179179 vtr::t_linked_vptr* vptr_prev = vptr;
180180 vptr = vptr->next ;
181- delete vptr_prev;
181+ vtr::free ( vptr_prev) ;
182182 }
183183 }
184184
185185 // Each model has different number of inputs/outputs - delete each model separately
186186 // Free INPAD
187- delete arch->model_library [LIB_INPUT].name ;
188- delete arch->model_library [LIB_INPUT].outputs ->name ;
187+ vtr::free ( arch->model_library [LIB_INPUT].name ;
188+ vtr::free ( arch->model_library [LIB_INPUT].outputs ->name ;
189189 delete[] arch->model_library [LIB_INPUT].outputs ;
190190
191191 // Free OUTPAD
192- delete arch->model_library [LIB_OUTPUT].name ;
193- delete arch->model_library [LIB_OUTPUT].inputs ->name ;
192+ vtr::free ( arch->model_library [LIB_OUTPUT].name ;
193+ vtr::free ( arch->model_library [LIB_OUTPUT].inputs ->name ;
194194 delete[] arch->model_library [LIB_OUTPUT].inputs ;
195195
196196 // Free LATCH triggered at RISING EDGE
197- delete arch->model_library [LIB_LATCH_RE].name ;
198- delete arch->model_library [LIB_LATCH_RE].inputs [0 ].name ;
199- delete arch->model_library [LIB_LATCH_RE].inputs [1 ].name ;
197+ vtr::free ( arch->model_library [LIB_LATCH_RE].name ;
198+ vtr::free ( arch->model_library [LIB_LATCH_RE].inputs [0 ].name ;
199+ vtr::free ( arch->model_library [LIB_LATCH_RE].inputs [1 ].name ;
200200 delete[] arch->model_library [LIB_LATCH_RE].inputs ;
201- delete arch->model_library [LIB_LATCH_RE].outputs ->name ;
201+ vtr::free ( arch->model_library [LIB_LATCH_RE].outputs ->name ;
202202 delete[] arch->model_library [LIB_LATCH_RE].outputs ;
203203
204204 // Free LATCH triggered at FALLING EDGE
205- delete arch->model_library [LIB_LATCH_FE].name ;
206- delete arch->model_library [LIB_LATCH_FE].inputs [0 ].name ;
207- delete arch->model_library [LIB_LATCH_FE].inputs [1 ].name ;
205+ vtr::free ( arch->model_library [LIB_LATCH_FE].name ;
206+ vtr::free ( arch->model_library [LIB_LATCH_FE].inputs [0 ].name ;
207+ vtr::free ( arch->model_library [LIB_LATCH_FE].inputs [1 ].name ;
208208 delete[] arch->model_library [LIB_LATCH_FE].inputs ;
209- delete arch->model_library [LIB_LATCH_FE].outputs ->name ;
209+ vtr::free ( arch->model_library [LIB_LATCH_FE].outputs ->name ;
210210 delete[] arch->model_library [LIB_LATCH_FE].outputs ;
211211
212212 // Free NAMES
213- delete arch->model_library [LIB_NAMES].name ;
214- delete arch->model_library [LIB_NAMES].inputs ->name ;
213+ vtr::free ( arch->model_library [LIB_NAMES].name ;
214+ vtr::free ( arch->model_library [LIB_NAMES].inputs ->name ;
215215 delete[] arch->model_library [LIB_NAMES].inputs ;
216- delete arch->model_library [LIB_NAMES].outputs ->name ;
216+ vtr::free ( arch->model_library [LIB_NAMES].outputs ->name ;
217217 delete[] arch->model_library [LIB_NAMES].outputs ;
218218
219219 // Free the library array
220220 delete[] arch->model_library ;
221221 }
222222
223223 if (arch->clocks ) {
224- delete arch->clocks ->clock_inf ;
224+ vtr::free ( arch->clocks ->clock_inf ) ;
225225 }
226226
227227 delete (arch->noc );
@@ -248,12 +248,12 @@ t_model* free_arch_model(t_model* model) {
248248 while (vptr) {
249249 vtr::t_linked_vptr* vptr_prev = vptr;
250250 vptr = vptr->next ;
251- delete vptr_prev;
251+ vtr::free ( vptr_prev) ;
252252 }
253253
254254 if (model->instances )
255255 vtr::free (model->instances );
256- delete model->name ;
256+ vtr::free ( model->name ) ;
257257 delete model;
258258
259259 return next_model;
@@ -273,24 +273,24 @@ t_model_ports* free_arch_model_port(t_model_ports* model_port) {
273273
274274 t_model_ports* next_port = model_port->next ;
275275
276- delete model_port->name ;
276+ vtr::free ( model_port->name ) ;
277277 delete model_port;
278278
279279 return next_port;
280280}
281281
282282void free_type_descriptors (std::vector<t_physical_tile_type>& type_descriptors) {
283283 for (auto & type : type_descriptors) {
284- delete type.name ;
284+ vtr::free ( type.name ) ;
285285 if (type.index == EMPTY_TYPE_INDEX) {
286286 continue ;
287287 }
288288
289289 for (auto & sub_tile : type.sub_tiles ) {
290- delete sub_tile.name ;
290+ vtr::free ( sub_tile.name ) ;
291291
292292 for (auto port : sub_tile.ports ) {
293- delete port.name ;
293+ vtr::free ( port.name ) ;
294294 }
295295 }
296296 }
@@ -301,7 +301,7 @@ void free_type_descriptors(std::vector<t_logical_block_type>& type_descriptors)
301301 free_all_pb_graph_nodes (type_descriptors);
302302
303303 for (auto & type : type_descriptors) {
304- delete type.name ;
304+ vtr::free ( type.name ) ;
305305 if (type.index == EMPTY_TYPE_INDEX) {
306306 continue ;
307307 }
@@ -421,98 +421,98 @@ static void free_pb_graph(t_pb_graph_node* pb_graph_node) {
421421 for (k = 0 ; k < pb_type->modes [i].pb_type_children [j].num_pb ; k++) {
422422 free_pb_graph (&pb_graph_node->child_pb_graph_nodes [i][j][k]);
423423 }
424- delete pb_graph_node->child_pb_graph_nodes [i][j];
424+ vtr::free ( pb_graph_node->child_pb_graph_nodes [i][j]) ;
425425 }
426- delete pb_graph_node->child_pb_graph_nodes [i];
426+ vtr::free ( pb_graph_node->child_pb_graph_nodes [i]) ;
427427 }
428- delete pb_graph_node->child_pb_graph_nodes ;
428+ vtr::free ( pb_graph_node->child_pb_graph_nodes ) ;
429429}
430430
431431static void free_pb_type (t_pb_type* pb_type) {
432- delete pb_type->name ;
432+ vtr::free ( pb_type->name ) ;
433433 if (pb_type->blif_model )
434- delete pb_type->blif_model ;
434+ vtr::free ( pb_type->blif_model ) ;
435435
436436 for (int i = 0 ; i < pb_type->num_modes ; ++i) {
437437 for (int j = 0 ; j < pb_type->modes [i].num_pb_type_children ; ++j) {
438438 free_pb_type (&pb_type->modes [i].pb_type_children [j]);
439439 }
440440 delete[] pb_type->modes [i].pb_type_children ;
441- delete pb_type->modes [i].name ;
441+ vtr::free ( pb_type->modes [i].name ) ;
442442 for (int j = 0 ; j < pb_type->modes [i].num_interconnect ; ++j) {
443- delete pb_type->modes [i].interconnect [j].input_string ;
444- delete pb_type->modes [i].interconnect [j].output_string ;
445- delete pb_type->modes [i].interconnect [j].name ;
443+ vtr::free ( pb_type->modes [i].interconnect [j].input_string ) ;
444+ vtr::free ( pb_type->modes [i].interconnect [j].output_string ) ;
445+ vtr::free ( pb_type->modes [i].interconnect [j].name ) ;
446446
447447 for (int k = 0 ; k < pb_type->modes [i].interconnect [j].num_annotations ; ++k) {
448448 if (pb_type->modes [i].interconnect [j].annotations [k].clock )
449- delete pb_type->modes [i].interconnect [j].annotations [k].clock ;
449+ vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].clock ) ;
450450 if (pb_type->modes [i].interconnect [j].annotations [k].input_pins ) {
451- delete pb_type->modes [i].interconnect [j].annotations [k].input_pins ;
451+ vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].input_pins ) ;
452452 }
453453 if (pb_type->modes [i].interconnect [j].annotations [k].output_pins ) {
454- delete pb_type->modes [i].interconnect [j].annotations [k].output_pins ;
454+ vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].output_pins ) ;
455455 }
456456 for (int m = 0 ; m < pb_type->modes [i].interconnect [j].annotations [k].num_value_prop_pairs ; ++m) {
457- delete pb_type->modes [i].interconnect [j].annotations [k].value [m];
457+ vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].value [m]) ;
458458 }
459- delete pb_type->modes [i].interconnect [j].annotations [k].prop ;
460- delete pb_type->modes [i].interconnect [j].annotations [k].value ;
459+ vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].prop ) ;
460+ vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].value ) ;
461461 }
462- delete pb_type->modes [i].interconnect [j].annotations ;
462+ vtr::free ( pb_type->modes [i].interconnect [j].annotations ) ;
463463 if (pb_type->modes [i].interconnect [j].interconnect_power )
464- delete pb_type->modes [i].interconnect [j].interconnect_power ;
464+ vtr::free ( pb_type->modes [i].interconnect [j].interconnect_power ) ;
465465 }
466466 if (pb_type->modes [i].interconnect )
467467 delete[] pb_type->modes [i].interconnect ;
468468 if (pb_type->modes [i].mode_power )
469- delete pb_type->modes [i].mode_power ;
469+ vtr::free ( pb_type->modes [i].mode_power ) ;
470470 }
471471 if (pb_type->modes )
472472 delete[] pb_type->modes ;
473473
474474 for (int i = 0 ; i < pb_type->num_annotations ; ++i) {
475475 for (int j = 0 ; j < pb_type->annotations [i].num_value_prop_pairs ; ++j) {
476- delete pb_type->annotations [i].value [j];
476+ vtr::free ( pb_type->annotations [i].value [j]) ;
477477 }
478- delete pb_type->annotations [i].value ;
479- delete pb_type->annotations [i].prop ;
478+ vtr::free ( pb_type->annotations [i].value ) ;
479+ vtr::free ( pb_type->annotations [i].prop ) ;
480480 if (pb_type->annotations [i].input_pins ) {
481- delete pb_type->annotations [i].input_pins ;
481+ vtr::free ( pb_type->annotations [i].input_pins ) ;
482482 }
483483 if (pb_type->annotations [i].output_pins ) {
484- delete pb_type->annotations [i].output_pins ;
484+ vtr::free ( pb_type->annotations [i].output_pins ) ;
485485 }
486486 if (pb_type->annotations [i].clock ) {
487- delete pb_type->annotations [i].clock ;
487+ vtr::free ( pb_type->annotations [i].clock ) ;
488488 }
489489 }
490490 if (pb_type->num_annotations > 0 ) {
491- delete pb_type->annotations ;
491+ vtr::free ( pb_type->annotations ) ;
492492 }
493493
494494 if (pb_type->pb_type_power ) {
495- delete pb_type->pb_type_power ;
495+ vtr::free ( pb_type->pb_type_power ) ;
496496 }
497497
498498 for (int i = 0 ; i < pb_type->num_ports ; ++i) {
499- delete pb_type->ports [i].name ;
499+ vtr::free ( pb_type->ports [i].name ) ;
500500 if (pb_type->class_type == LATCH_CLASS)
501- delete pb_type->ports_sec [i].name ;
501+ vtr::free ( pb_type->ports_sec [i].name ) ;
502502 if (pb_type->ports [i].port_class ) {
503- delete pb_type->ports [i].port_class ;
503+ vtr::free ( pb_type->ports [i].port_class ) ;
504504 if (pb_type->class_type == LATCH_CLASS)
505- delete pb_type->ports_sec [i].port_class ;
505+ vtr::free ( pb_type->ports_sec [i].port_class ) ;
506506 }
507507 if (pb_type->ports [i].port_power ) {
508- delete pb_type->ports [i].port_power ;
508+ vtr::free ( pb_type->ports [i].port_power ) ;
509509 if (pb_type->class_type == LATCH_CLASS)
510- delete pb_type->ports_sec [i].port_power ;
510+ vtr::free ( pb_type->ports_sec [i].port_power ) ;
511511 }
512512 }
513- delete pb_type->ports ;
513+ vtr::free ( pb_type->ports ) ;
514514 if (pb_type->class_type == LATCH_CLASS)
515- delete pb_type->ports_sec ;
515+ vtr::free ( pb_type->ports_sec ) ;
516516}
517517
518518t_port* findPortByName (const char * name, t_pb_type* pb_type, int * high_index, int * low_index) {
@@ -809,22 +809,22 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
809809 /* moved annotations to child so delete old annotations */
810810 for (i = 0 ; i < lut_pb_type->num_annotations ; i++) {
811811 for (j = 0 ; j < lut_pb_type->annotations [i].num_value_prop_pairs ; j++) {
812- delete lut_pb_type->annotations [i].value [j];
812+ free ( lut_pb_type->annotations [i].value [j]) ;
813813 }
814- delete lut_pb_type->annotations [i].value ;
815- delete lut_pb_type->annotations [i].prop ;
814+ free ( lut_pb_type->annotations [i].value ) ;
815+ free ( lut_pb_type->annotations [i].prop ) ;
816816 if (lut_pb_type->annotations [i].input_pins ) {
817- delete lut_pb_type->annotations [i].input_pins ;
817+ free ( lut_pb_type->annotations [i].input_pins ) ;
818818 }
819819 if (lut_pb_type->annotations [i].output_pins ) {
820- delete lut_pb_type->annotations [i].output_pins ;
820+ free ( lut_pb_type->annotations [i].output_pins ) ;
821821 }
822822 if (lut_pb_type->annotations [i].clock ) {
823- delete lut_pb_type->annotations [i].clock ;
823+ free ( lut_pb_type->annotations [i].clock ) ;
824824 }
825825 }
826826 lut_pb_type->num_annotations = 0 ;
827- delete lut_pb_type->annotations ;
827+ free ( lut_pb_type->annotations ) ;
828828 lut_pb_type->annotations = nullptr ;
829829 lut_pb_type->modes [1 ].pb_type_children [0 ].depth = lut_pb_type->depth + 1 ;
830830 lut_pb_type->modes [1 ].pb_type_children [0 ].parent_mode = &lut_pb_type->modes [1 ];
@@ -873,9 +873,9 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
873873 lut_pb_type->modes [1 ].interconnect [1 ].parent_mode = &lut_pb_type->modes [1 ];
874874 lut_pb_type->modes [1 ].interconnect [1 ].interconnect_power = (t_interconnect_power*)vtr::calloc (1 , sizeof (t_interconnect_power));
875875
876- delete default_name;
876+ free ( default_name) ;
877877
878- delete lut_pb_type->blif_model ;
878+ free ( lut_pb_type->blif_model ) ;
879879 lut_pb_type->blif_model = nullptr ;
880880 lut_pb_type->model = nullptr ;
881881}
@@ -924,7 +924,7 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
924924
925925 mem_pb_type->num_modes = 1 ;
926926
927- delete mem_pb_type->blif_model ;
927+ free ( mem_pb_type->blif_model ) ;
928928 mem_pb_type->blif_model = nullptr ;
929929 mem_pb_type->model = nullptr ;
930930
@@ -1043,7 +1043,7 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
10431043
10441044 mem_pb_type->modes [0 ].num_interconnect = i_inter;
10451045
1046- delete default_name;
1046+ free ( default_name) ;
10471047}
10481048
10491049e_power_estimation_method power_method_inherited (e_power_estimation_method parent_power_method) {
0 commit comments