Skip to content

Commit e3d20c6

Browse files
authored
Merge pull request #7800 from The-OpenROAD-Project-staging/member-underscore-tidy
various: Add _ to class members; remove from struct members
2 parents 12b9147 + bac8a6e commit e3d20c6

Some content is hidden

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

80 files changed

+1313
-1265
lines changed

src/cts/src/SinkClustering.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ using utl::Logger;
2525
class Matching
2626
{
2727
public:
28-
Matching(unsigned p0, unsigned p1) : p_0(p0), p_1(p1) {}
28+
Matching(unsigned p0, unsigned p1) : p0_(p0), p1_(p1) {}
2929

30-
unsigned getP0() const { return p_0; }
31-
unsigned getP1() const { return p_1; }
30+
unsigned getP0() const { return p0_; }
31+
unsigned getP1() const { return p1_; }
3232

3333
private:
34-
const unsigned p_0;
35-
const unsigned p_1;
34+
const unsigned p0_;
35+
const unsigned p1_;
3636
};
3737

3838
class SinkClustering

src/dpl/include/dpl/OptMirror.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ class NetBox
2424
{
2525
public:
2626
NetBox() = default;
27-
NetBox(dbNet* net, Rect box, bool ignore);
27+
NetBox(dbNet* net, const Rect& box, bool ignore);
2828
int64_t hpwl();
2929
void saveBox();
3030
void restoreBox();
31+
bool isIgnore() const { return ignore_; }
32+
dbNet* getNet() const { return net_; }
33+
const Rect& getBox() const { return box_; }
3134

35+
void setBox(const Rect& box) { box_ = box; }
36+
37+
private:
3238
dbNet* net_ = nullptr;
3339
Rect box_;
3440
Rect box_saved_;

src/dpl/src/OptMirror.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ using odb::dbOrientType;
2424

2525
static dbOrientType orientMirrorY(const dbOrientType& orient);
2626

27-
NetBox::NetBox(dbNet* net, Rect box, bool ignore)
27+
NetBox::NetBox(dbNet* net, const Rect& box, bool ignore)
2828
: net_(net), box_(box), ignore_(ignore)
2929
{
3030
}
@@ -118,9 +118,9 @@ std::vector<dbInst*> OptimizeMirroring::findMirrorCandidates(
118118
unordered_set<dbInst*> existing;
119119
// Find inst terms on the boundary of the net boxes.
120120
for (NetBox* net_box : net_boxes) {
121-
if (!net_box->ignore_) {
122-
dbNet* net = net_box->net_;
123-
Rect& box = net_box->box_;
121+
if (!net_box->isIgnore()) {
122+
dbNet* net = net_box->getNet();
123+
const Rect& box = net_box->getBox();
124124
for (dbITerm* iterm : net->getITerms()) {
125125
dbInst* inst = iterm->getInst();
126126
int x, y;
@@ -204,7 +204,7 @@ int64_t OptimizeMirroring::hpwl(dbInst* inst)
204204
dbNet* net = iterm->getNet();
205205
if (net) {
206206
NetBox& net_box = net_box_map_[net];
207-
if (!net_box.ignore_) {
207+
if (!net_box.isIgnore()) {
208208
inst_hpwl += net_box.hpwl();
209209
}
210210
}
@@ -218,8 +218,8 @@ void OptimizeMirroring::updateNetBoxes(dbInst* inst)
218218
dbNet* net = iterm->getNet();
219219
if (net) {
220220
NetBox& net_box = net_box_map_[net];
221-
if (!net_box.ignore_) {
222-
net_box_map_[net].box_ = net->getTermBBox();
221+
if (!net_box.isIgnore()) {
222+
net_box_map_[net].setBox(net->getTermBBox());
223223
}
224224
}
225225
}

src/dpl/src/Optdp.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@ void Opendp::improvePlacement(const int seed,
9292
// Everything done through a script string.
9393

9494
DetailedParams dtParams;
95-
dtParams.script_ = "";
95+
dtParams.script = "";
9696
// Maximum independent set matching.
97-
dtParams.script_ += "mis -p 10 -t 0.005;";
97+
dtParams.script += "mis -p 10 -t 0.005;";
9898
// Global swaps.
99-
dtParams.script_ += "gs -p 10 -t 0.005;";
99+
dtParams.script += "gs -p 10 -t 0.005;";
100100
// Vertical swaps.
101-
dtParams.script_ += "vs -p 10 -t 0.005;";
101+
dtParams.script += "vs -p 10 -t 0.005;";
102102
// Small reordering.
103-
dtParams.script_ += "ro -p 10 -t 0.005;";
103+
dtParams.script += "ro -p 10 -t 0.005;";
104104
// Random moves and swaps with hpwl as a cost function. Use
105105
// random moves and hpwl objective right now.
106-
dtParams.script_ += "default -p 5 -f 20 -gen rng -obj hpwl -cost (hpwl);";
106+
dtParams.script += "default -p 5 -f 20 -gen rng -obj hpwl -cost (hpwl);";
107107

108108
if (disallow_one_site_gaps) {
109-
dtParams.script_ += "disallow_one_site_gaps;";
109+
dtParams.script += "disallow_one_site_gaps;";
110110
}
111111

112112
// Run the script.

src/dpl/src/PlacementDRC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ bool PlacementDRC::checkBlockedLayers(const Node* cell,
156156
for (GridY y1 = y_begin; y1 < y_end; y1++) {
157157
for (GridX x1 = x_begin; x1 < x_end; x1++) {
158158
const Pixel* pixel = grid_->gridPixel(x1, y1);
159-
if (pixel != nullptr && pixel->blocked_layers_ & cell->getUsedLayers()) {
159+
if (pixel != nullptr && pixel->blocked_layers & cell->getUsedLayers()) {
160160
return false;
161161
}
162162
}
@@ -242,4 +242,4 @@ DbuX PlacementDRC::gridToDbu(const GridX grid_x, const DbuX site_width) const
242242
return DbuX(grid_x.v * site_width.v);
243243
}
244244

245-
} // namespace dpl
245+
} // namespace dpl

src/dpl/src/infrastructure/Grid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void Grid::allocateGrid()
7373
pixel.util = 0.0;
7474
pixel.is_valid = false;
7575
pixel.is_hopeless = false;
76-
pixel.blocked_layers_ = 0;
76+
pixel.blocked_layers = 0;
7777
}
7878
}
7979
}
@@ -152,7 +152,7 @@ void Grid::markBlocked(dbBlock* block)
152152
for (GridX x = grid_rect.xlo; x < grid_rect.xhi; x++) {
153153
auto pixel1 = gridPixel(x, y);
154154
if (pixel1) {
155-
pixel1->blocked_layers_ |= 1 << routing_level;
155+
pixel1->blocked_layers |= 1 << routing_level;
156156
}
157157
}
158158
}

src/dpl/src/infrastructure/Grid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct Pixel
3939
bool is_valid = false; // false for dummy cells
4040
bool is_hopeless = false; // too far from sites for diamond search
4141
std::map<dbSite*, dbOrientType> sites;
42-
uint8_t blocked_layers_ = 0;
42+
uint8_t blocked_layers = 0;
4343
};
4444

4545
// Return value for grid searches.

src/dpl/src/infrastructure/network.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class Network
4646
{
4747
return a->getEdge()->getId() < b->getEdge()->getId();
4848
}
49+
50+
private:
4951
Network* nw_ = nullptr;
5052
};
5153

@@ -60,6 +62,8 @@ class Network
6062
}
6163
return a->getOffsetX() < b->getOffsetX();
6264
}
65+
66+
private:
6367
Network* nw_ = nullptr;
6468
};
6569

src/dpl/src/legalize_shift.cxx

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ namespace dpl {
2727

2828
struct ShiftLegalizer::Clump
2929
{
30-
int id_ = 0;
31-
double weight_ = 0.0;
32-
double wposn_ = 0.0;
30+
int id = 0;
31+
double weight = 0.0;
32+
double wposn = 0.0;
3333
// Left edge of clump should be integer, although
3434
// the computation can be double.
35-
int posn_ = 0;
36-
std::vector<Node*> nodes_;
35+
int posn = 0;
36+
std::vector<Node*> nodes;
3737
};
3838

3939
//////////////////////////////////////////////////////////////////////////////
@@ -331,12 +331,12 @@ double ShiftLegalizer::clump(std::vector<Node*>& order)
331331

332332
const double wt = 1.0e8;
333333

334-
r->id_ = clumpId;
335-
r->nodes_.clear();
336-
r->nodes_.push_back(ndi);
337-
r->wposn_ = wt * ndi->getLeft().v;
338-
r->weight_ = wt; // Massive weight for segment start.
339-
r->posn_ = ndi->getLeft().v;
334+
r->id = clumpId;
335+
r->nodes.clear();
336+
r->nodes.push_back(ndi);
337+
r->wposn = wt * ndi->getLeft().v;
338+
r->weight = wt; // Massive weight for segment start.
339+
r->posn = ndi->getLeft().v;
340340

341341
++clumpId;
342342
}
@@ -351,12 +351,12 @@ double ShiftLegalizer::clump(std::vector<Node*>& order)
351351

352352
const double wt = 1.0;
353353

354-
r->id_ = (int) i;
355-
r->nodes_.clear();
356-
r->nodes_.push_back(ndi);
357-
r->wposn_ = wt * ndi->getLeft().v;
358-
r->weight_ = wt;
359-
r->posn_ = ndi->getLeft().v;
354+
r->id = (int) i;
355+
r->nodes.clear();
356+
r->nodes.push_back(ndi);
357+
r->wposn = wt * ndi->getLeft().v;
358+
r->weight = wt;
359+
r->posn = ndi->getLeft().v;
360360

361361
// Always ensure the left edge is within the segments
362362
// in which the cell is assigned.
@@ -365,8 +365,7 @@ double ShiftLegalizer::clump(std::vector<Node*>& order)
365365
DbuX xmin = segPtr->getMinX();
366366
DbuX xmax = segPtr->getMaxX();
367367
// Left edge always within segment.
368-
r->posn_
369-
= std::min(std::max(r->posn_, xmin.v), xmax.v - ndi->getWidth().v);
368+
r->posn = std::min(std::max(r->posn, xmin.v), xmax.v - ndi->getWidth().v);
370369
}
371370

372371
++clumpId;
@@ -381,12 +380,12 @@ double ShiftLegalizer::clump(std::vector<Node*>& order)
381380

382381
const double wt = 1.0e8;
383382

384-
r->id_ = clumpId;
385-
r->nodes_.clear();
386-
r->nodes_.push_back(ndi);
387-
r->wposn_ = wt * ndi->getLeft().v;
388-
r->weight_ = wt; // Massive weight for segment end.
389-
r->posn_ = ndi->getLeft().v;
383+
r->id = clumpId;
384+
r->nodes.clear();
385+
r->nodes.push_back(ndi);
386+
r->wposn = wt * ndi->getLeft().v;
387+
r->weight = wt; // Massive weight for segment end.
388+
r->posn = ndi->getLeft().v;
390389

391390
++clumpId;
392391
}
@@ -409,7 +408,7 @@ double ShiftLegalizer::clump(std::vector<Node*>& order)
409408

410409
// Left edge.
411410
const DbuX oldX = ndi->getLeft();
412-
const DbuX newX{r->posn_ + offset_[ndi->getId()]};
411+
const DbuX newX{r->posn + offset_[ndi->getId()]};
413412

414413
ndi->setLeft(newX);
415414

@@ -436,20 +435,20 @@ void ShiftLegalizer::merge(Clump* r)
436435
// Merge clump r into clump l which, in turn, could result in more merges.
437436

438437
// Move blocks from r to l and update offsets, etc.
439-
for (const Node* ndi : r->nodes_) {
438+
for (const Node* ndi : r->nodes) {
440439
offset_[ndi->getId()] += dist;
441440
ptr_[ndi->getId()] = l;
442441
}
443-
l->nodes_.insert(l->nodes_.end(), r->nodes_.begin(), r->nodes_.end());
442+
l->nodes.insert(l->nodes.end(), r->nodes.begin(), r->nodes.end());
444443

445444
// Remove blocks from clump r.
446-
r->nodes_.clear();
445+
r->nodes.clear();
447446

448447
// Update position of clump l.
449-
l->wposn_ += r->wposn_ - dist * r->weight_;
450-
l->weight_ += r->weight_;
448+
l->wposn += r->wposn - dist * r->weight;
449+
l->weight += r->weight;
451450
// Rounding down should always be fine since we merge to the left.
452-
l->posn_ = (int) std::floor(l->wposn_ / l->weight_);
451+
l->posn = (int) std::floor(l->wposn / l->weight);
453452

454453
// Since clump l changed position, we need to make it the new right clump
455454
// and see if there are more merges to the left.
@@ -471,8 +470,8 @@ bool ShiftLegalizer::violated(Clump* r, Clump*& l, int& dist)
471470
int worst_diff = std::numeric_limits<int>::max();
472471
dist = std::numeric_limits<int>::max();
473472

474-
for (size_t i = 0; i < r->nodes_.size(); i++) {
475-
const Node* ndr = r->nodes_[i];
473+
for (size_t i = 0; i < r->nodes.size(); i++) {
474+
const Node* ndr = r->nodes[i];
476475

477476
// Look at each cell that must be left of current cell.
478477
for (size_t j = 0; j < incoming_[ndr->getId()].size(); j++) {
@@ -495,8 +494,8 @@ bool ShiftLegalizer::violated(Clump* r, Clump*& l, int& dist)
495494
continue;
496495
}
497496
// Get left edge of both cells.
498-
const int pdst = r->posn_ + offset_[ndr->getId()];
499-
const int psrc = t->posn_ + offset_[ndl->getId()];
497+
const int pdst = r->posn + offset_[ndr->getId()];
498+
const int psrc = t->posn + offset_[ndl->getId()];
500499
const int gap = ndl->getWidth().v;
501500
const int diff = pdst - (psrc + gap);
502501
if (diff < 0 && diff < worst_diff) {

src/dpl/src/optimization/detailed.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bool Detailed::improve(DetailedMgr& mgr)
3939

4040
// Parse the script string and run each command.
4141
boost::char_separator<char> separators(" \r\t\n", ";");
42-
boost::tokenizer<boost::char_separator<char>> tokens(params_.script_,
42+
boost::tokenizer<boost::char_separator<char>> tokens(params_.script,
4343
separators);
4444
std::vector<std::string> args;
4545
for (auto temp : tokens) {

0 commit comments

Comments
 (0)