Skip to content

Commit 2e6d089

Browse files
set AllowShortIfStatementsOnASingleLine to false
1 parent a2d9b0b commit 2e6d089

File tree

270 files changed

+6134
-2342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+6134
-2342
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AllowAllParametersOfDeclarationOnNextLine: false
1111
AllowShortBlocksOnASingleLine: true
1212
AllowShortCaseLabelsOnASingleLine: false
1313
AllowShortFunctionsOnASingleLine: true
14-
AllowShortIfStatementsOnASingleLine: true
14+
AllowShortIfStatementsOnASingleLine: false
1515
AllowShortLoopsOnASingleLine: false
1616
AlwaysBreakAfterDefinitionReturnType: None
1717
AlwaysBreakAfterReturnType: None

libs/libarchfpga/src/arch_check.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ bool check_model_clocks(t_model* model, const char* file, uint32_t line) {
1010
std::set<std::string> clocks;
1111
for (t_model_ports* ports : {model->inputs, model->outputs}) {
1212
for (t_model_ports* port = ports; port != nullptr; port = port->next) {
13-
if (port->is_clock) { clocks.insert(port->name); }
13+
if (port->is_clock) {
14+
clocks.insert(port->name);
15+
}
1416
}
1517
}
1618

@@ -140,16 +142,22 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
140142
std::string blif_model = pb_type->blif_model;
141143
std::string subckt = ".subckt ";
142144
auto pos = blif_model.find(subckt);
143-
if (pos != std::string::npos) { blif_model = blif_model.substr(pos + subckt.size()); }
145+
if (pos != std::string::npos) {
146+
blif_model = blif_model.substr(pos + subckt.size());
147+
}
144148

145149
//Find the matching model
146150
const t_model* model = nullptr;
147151

148152
for (const t_model* models : {arch.models, arch.model_library}) {
149153
for (model = models; model != nullptr; model = model->next) {
150-
if (std::string(model->name) == blif_model) { break; }
154+
if (std::string(model->name) == blif_model) {
155+
break;
156+
}
157+
}
158+
if (model != nullptr) {
159+
break;
151160
}
152-
if (model != nullptr) { break; }
153161
}
154162
if (model == nullptr) {
155163
archfpga_throw(get_arch_file_name(), -1, "Unable to find model for blif_model '%s' found on pb_type '%s'",
@@ -186,7 +194,8 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
186194
break;
187195
}
188196
}
189-
if (model_port != nullptr) break;
197+
if (model_port != nullptr)
198+
break;
190199
}
191200
if (model_port == nullptr) {
192201
archfpga_throw(get_arch_file_name(), annot->line_num,

libs/libarchfpga/src/arch_util.cpp

Lines changed: 86 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ int InstPort::num_pins() const {
146146
}
147147

148148
void free_arch(t_arch* arch) {
149-
if (arch == nullptr) { return; }
149+
if (arch == nullptr) {
150+
return;
151+
}
150152

151153
delete[] arch->Switches;
152154
arch->Switches = nullptr;
@@ -192,7 +194,9 @@ void free_arch(t_arch* arch) {
192194
delete[] arch->model_library;
193195
}
194196

195-
if (arch->clocks) { vtr::free(arch->clocks->clock_inf); }
197+
if (arch->clocks) {
198+
vtr::free(arch->clocks->clock_inf);
199+
}
196200

197201
delete (arch->noc);
198202
}
@@ -207,7 +211,8 @@ void free_arch_models(t_model* models) {
207211

208212
//Frees the specified model, and returns the next model (if any) in the linked list
209213
t_model* free_arch_model(t_model* model) {
210-
if (!model) return nullptr;
214+
if (!model)
215+
return nullptr;
211216

212217
t_model* next_model = model->next;
213218

@@ -221,7 +226,8 @@ t_model* free_arch_model(t_model* model) {
221226
vtr::free(vptr_prev);
222227
}
223228

224-
if (model->instances) vtr::free(model->instances);
229+
if (model->instances)
230+
vtr::free(model->instances);
225231
vtr::free(model->name);
226232
delete model;
227233

@@ -238,7 +244,8 @@ void free_arch_model_ports(t_model_ports* model_ports) {
238244

239245
//Frees the specified model_port, and returns the next model_port (if any) in the linked list
240246
t_model_ports* free_arch_model_port(t_model_ports* model_port) {
241-
if (!model_port) return nullptr;
247+
if (!model_port)
248+
return nullptr;
242249

243250
t_model_ports* next_port = model_port->next;
244251

@@ -251,7 +258,9 @@ t_model_ports* free_arch_model_port(t_model_ports* model_port) {
251258
void free_type_descriptors(std::vector<t_physical_tile_type>& type_descriptors) {
252259
for (auto& type : type_descriptors) {
253260
vtr::free(type.name);
254-
if (type.index == EMPTY_TYPE_INDEX) { continue; }
261+
if (type.index == EMPTY_TYPE_INDEX) {
262+
continue;
263+
}
255264

256265
for (auto& sub_tile : type.sub_tiles) {
257266
vtr::free(sub_tile.name);
@@ -269,7 +278,9 @@ void free_type_descriptors(std::vector<t_logical_block_type>& type_descriptors)
269278

270279
for (auto& type : type_descriptors) {
271280
vtr::free(type.name);
272-
if (type.index == EMPTY_TYPE_INDEX) { continue; }
281+
if (type.index == EMPTY_TYPE_INDEX) {
282+
continue;
283+
}
273284

274285
free_pb_type(type.pb_type);
275286
delete type.pb_type;
@@ -343,7 +354,8 @@ static void free_pb_graph(t_pb_graph_node* pb_graph_node) {
343354

344355
if (pb_graph_node->interconnect_pins) {
345356
for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
346-
if (pb_graph_node->interconnect_pins[i] == nullptr) continue;
357+
if (pb_graph_node->interconnect_pins[i] == nullptr)
358+
continue;
347359

348360
t_mode* mode = &pb_graph_node->pb_type->modes[i];
349361

@@ -383,7 +395,8 @@ static void free_pb_graph(t_pb_graph_node* pb_graph_node) {
383395

384396
static void free_pb_type(t_pb_type* pb_type) {
385397
vtr::free(pb_type->name);
386-
if (pb_type->blif_model) vtr::free(pb_type->blif_model);
398+
if (pb_type->blif_model)
399+
vtr::free(pb_type->blif_model);
387400

388401
for (int i = 0; i < pb_type->num_modes; ++i) {
389402
for (int j = 0; j < pb_type->modes[i].num_pb_type_children; ++j) {
@@ -415,29 +428,46 @@ static void free_pb_type(t_pb_type* pb_type) {
415428
if (pb_type->modes[i].interconnect[j].interconnect_power)
416429
vtr::free(pb_type->modes[i].interconnect[j].interconnect_power);
417430
}
418-
if (pb_type->modes[i].interconnect) delete[] pb_type->modes[i].interconnect;
419-
if (pb_type->modes[i].mode_power) vtr::free(pb_type->modes[i].mode_power);
431+
if (pb_type->modes[i].interconnect)
432+
delete[] pb_type->modes[i].interconnect;
433+
if (pb_type->modes[i].mode_power)
434+
vtr::free(pb_type->modes[i].mode_power);
420435
}
421-
if (pb_type->modes) delete[] pb_type->modes;
436+
if (pb_type->modes)
437+
delete[] pb_type->modes;
422438

423439
for (int i = 0; i < pb_type->num_annotations; ++i) {
424440
for (int j = 0; j < pb_type->annotations[i].num_value_prop_pairs; ++j) {
425441
vtr::free(pb_type->annotations[i].value[j]);
426442
}
427443
vtr::free(pb_type->annotations[i].value);
428444
vtr::free(pb_type->annotations[i].prop);
429-
if (pb_type->annotations[i].input_pins) { vtr::free(pb_type->annotations[i].input_pins); }
430-
if (pb_type->annotations[i].output_pins) { vtr::free(pb_type->annotations[i].output_pins); }
431-
if (pb_type->annotations[i].clock) { vtr::free(pb_type->annotations[i].clock); }
445+
if (pb_type->annotations[i].input_pins) {
446+
vtr::free(pb_type->annotations[i].input_pins);
447+
}
448+
if (pb_type->annotations[i].output_pins) {
449+
vtr::free(pb_type->annotations[i].output_pins);
450+
}
451+
if (pb_type->annotations[i].clock) {
452+
vtr::free(pb_type->annotations[i].clock);
453+
}
454+
}
455+
if (pb_type->num_annotations > 0) {
456+
vtr::free(pb_type->annotations);
432457
}
433-
if (pb_type->num_annotations > 0) { vtr::free(pb_type->annotations); }
434458

435-
if (pb_type->pb_type_power) { vtr::free(pb_type->pb_type_power); }
459+
if (pb_type->pb_type_power) {
460+
vtr::free(pb_type->pb_type_power);
461+
}
436462

437463
for (int i = 0; i < pb_type->num_ports; ++i) {
438464
vtr::free(pb_type->ports[i].name);
439-
if (pb_type->ports[i].port_class) { vtr::free(pb_type->ports[i].port_class); }
440-
if (pb_type->ports[i].port_power) { vtr::free(pb_type->ports[i].port_power); }
465+
if (pb_type->ports[i].port_class) {
466+
vtr::free(pb_type->ports[i].port_class);
467+
}
468+
if (pb_type->ports[i].port_power) {
469+
vtr::free(pb_type->ports[i].port_power);
470+
}
441471
}
442472
vtr::free(pb_type->ports);
443473
}
@@ -462,7 +492,9 @@ t_port* findPortByName(const char* name, t_pb_type* pb_type, int* high_index, in
462492
break;
463493
}
464494
}
465-
if (i >= pb_type->num_ports) { return nullptr; }
495+
if (i >= pb_type->num_ports) {
496+
return nullptr;
497+
}
466498

467499
/* Get indices */
468500
if (strlen(name) > bracket_pos) {
@@ -702,9 +734,15 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
702734
}
703735
free(lut_pb_type->annotations[i].value);
704736
free(lut_pb_type->annotations[i].prop);
705-
if (lut_pb_type->annotations[i].input_pins) { free(lut_pb_type->annotations[i].input_pins); }
706-
if (lut_pb_type->annotations[i].output_pins) { free(lut_pb_type->annotations[i].output_pins); }
707-
if (lut_pb_type->annotations[i].clock) { free(lut_pb_type->annotations[i].clock); }
737+
if (lut_pb_type->annotations[i].input_pins) {
738+
free(lut_pb_type->annotations[i].input_pins);
739+
}
740+
if (lut_pb_type->annotations[i].output_pins) {
741+
free(lut_pb_type->annotations[i].output_pins);
742+
}
743+
if (lut_pb_type->annotations[i].clock) {
744+
free(lut_pb_type->annotations[i].clock);
745+
}
708746
}
709747
lut_pb_type->num_annotations = 0;
710748
free(lut_pb_type->annotations);
@@ -1028,7 +1066,9 @@ void CreateModelLibrary(t_arch* arch) {
10281066

10291067
void SyncModelsPbTypes(t_arch* arch, const std::vector<t_logical_block_type>& Types) {
10301068
for (auto& Type : Types) {
1031-
if (Type.pb_type != nullptr) { SyncModelsPbTypes_rec(arch, Type.pb_type); }
1069+
if (Type.pb_type != nullptr) {
1070+
SyncModelsPbTypes_rec(arch, Type.pb_type);
1071+
}
10321072
}
10331073
}
10341074

@@ -1178,7 +1218,9 @@ void primitives_annotation_clock_match(t_pin_to_pin_annotation* annotation, t_pb
11781218
const t_segment_inf* find_segment(const t_arch* arch, std::string name) {
11791219
for (size_t i = 0; i < (arch->Segments).size(); ++i) {
11801220
const t_segment_inf* seg = &arch->Segments[i];
1181-
if (seg->name == name) { return seg; }
1221+
if (seg->name == name) {
1222+
return seg;
1223+
}
11821224
}
11831225

11841226
return nullptr;
@@ -1207,7 +1249,9 @@ bool block_type_contains_blif_model(t_logical_block_type_ptr type, const std::st
12071249

12081250
//Returns true of a pb_type (or it's children) contain the specified blif model name
12091251
bool pb_type_contains_blif_model(const t_pb_type* pb_type, const std::string& blif_model_name) {
1210-
if (!pb_type) { return false; }
1252+
if (!pb_type) {
1253+
return false;
1254+
}
12111255

12121256
if (pb_type->blif_model != nullptr) {
12131257
//Leaf pb_type
@@ -1223,7 +1267,9 @@ bool pb_type_contains_blif_model(const t_pb_type* pb_type, const std::string& bl
12231267

12241268
for (int ichild = 0; ichild < mode->num_pb_type_children; ++ichild) {
12251269
const t_pb_type* pb_type_child = &mode->pb_type_children[ichild];
1226-
if (pb_type_contains_blif_model(pb_type_child, blif_model_name)) { return true; }
1270+
if (pb_type_contains_blif_model(pb_type_child, blif_model_name)) {
1271+
return true;
1272+
}
12271273
}
12281274
}
12291275
}
@@ -1242,7 +1288,9 @@ const t_pin_to_pin_annotation* find_sequential_annotation(const t_pb_type* pb_ty
12421288
InstPort annot_in(annot->input_pins);
12431289
if (annot_in.port_name() == port->name) {
12441290
for (int iprop = 0; iprop < annot->num_value_prop_pairs; ++iprop) {
1245-
if (annot->prop[iprop] == annot_type) { return annot; }
1291+
if (annot->prop[iprop] == annot_type) {
1292+
return annot;
1293+
}
12461294
}
12471295
}
12481296
}
@@ -1277,7 +1325,8 @@ const t_pin_to_pin_annotation* find_combinational_annotation(const t_pb_type* pb
12771325
void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTileTypes,
12781326
std::vector<t_logical_block_type>& LogicalBlockTypes) {
12791327
for (auto& physical_tile : PhysicalTileTypes) {
1280-
if (physical_tile.index == EMPTY_TYPE_INDEX) continue;
1328+
if (physical_tile.index == EMPTY_TYPE_INDEX)
1329+
continue;
12811330

12821331
auto eq_sites_set = get_equivalent_sites_set(&physical_tile);
12831332
auto equivalent_sites = std::vector<t_logical_block_type_ptr>(eq_sites_set.begin(), eq_sites_set.end());
@@ -1307,7 +1356,8 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
13071356
}
13081357

13091358
for (auto& logical_block : LogicalBlockTypes) {
1310-
if (logical_block.index == EMPTY_TYPE_INDEX) continue;
1359+
if (logical_block.index == EMPTY_TYPE_INDEX)
1360+
continue;
13111361

13121362
auto& equivalent_tiles = logical_block.equivalent_tiles;
13131363

@@ -1427,7 +1477,9 @@ void setup_pin_classes(t_physical_tile_type* type) {
14271477
// clock pins and other specified global ports are flaged as global
14281478
type->is_pin_global[pin_count] = port.is_clock || port.is_non_clock_global;
14291479

1430-
if (port.is_clock) { type->clock_pin_indices.push_back(pin_count); }
1480+
if (port.is_clock) {
1481+
type->clock_pin_indices.push_back(pin_count);
1482+
}
14311483

14321484
pin_count++;
14331485
}
@@ -1457,7 +1509,9 @@ void setup_pin_classes(t_physical_tile_type* type) {
14571509
// clock pins and other specified global ports are flaged as global
14581510
type->is_pin_global[pin_count] = port.is_clock || port.is_non_clock_global;
14591511

1460-
if (port.is_clock) { type->clock_pin_indices.push_back(pin_count); }
1512+
if (port.is_clock) {
1513+
type->clock_pin_indices.push_back(pin_count);
1514+
}
14611515

14621516
pin_count++;
14631517

libs/libarchfpga/src/device_grid.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ DeviceGrid::DeviceGrid(std::string grid_name,
1818
size_t DeviceGrid::num_instances(t_physical_tile_type_ptr type, int layer_num) const {
1919
size_t count = 0;
2020
//instance_counts_ is not initialized
21-
if (instance_counts_.empty()) { return 0; }
21+
if (instance_counts_.empty()) {
22+
return 0;
23+
}
2224

2325
int num_layers = (int)grid_.dim_size(0);
2426

2527
if (layer_num == -1) {
2628
//Count all layers
2729
for (int curr_layer_num = 0; curr_layer_num < num_layers; ++curr_layer_num) {
2830
auto iter = instance_counts_[curr_layer_num].find(type);
29-
if (iter != instance_counts_[curr_layer_num].end()) { count += iter->second; }
31+
if (iter != instance_counts_[curr_layer_num].end()) {
32+
count += iter->second;
33+
}
3034
}
3135
return count;
3236
} else {

libs/libarchfpga/src/echo_arch.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ void EchoArch(const char* EchoFile,
116116
fprintf(Echo, "*************************************************\n");
117117

118118
for (auto& LogicalBlock : LogicalBlockTypes) {
119-
if (LogicalBlock.pb_type) { PrintPb_types_rec(Echo, LogicalBlock.pb_type, 2); }
119+
if (LogicalBlock.pb_type) {
120+
PrintPb_types_rec(Echo, LogicalBlock.pb_type, 2);
121+
}
120122
fprintf(Echo, "\n");
121123
}
122124

@@ -434,7 +436,9 @@ static void PrintPb_types_rec(FILE* Echo, const t_pb_type* pb_type, int level) {
434436
}
435437
}
436438

437-
if (pb_type->pb_type_power) { PrintPb_types_recPower(Echo, pb_type, tabs); }
439+
if (pb_type->pb_type_power) {
440+
PrintPb_types_recPower(Echo, pb_type, tabs);
441+
}
438442
free(tabs);
439443
}
440444

0 commit comments

Comments
 (0)