Skip to content

Commit 541c3d0

Browse files
authored
Merge pull request #8651 from hzeller/feature-20251014-using-techlayer
Fix various namespace pollutions by `using odb::...` in header files
2 parents bd12693 + ad69c6f commit 541c3d0

Some content is hidden

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

64 files changed

+335
-285
lines changed

src/dpl/include/dpl/Opendp.h

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ namespace dpl {
2929

3030
using utl::Logger;
3131

32-
using odb::dbDatabase;
33-
using odb::dbMaster;
34-
using odb::dbMasterType;
35-
using odb::dbTechLayer;
36-
3732
class Node;
3833
class Group;
3934
class Master;
@@ -73,7 +68,7 @@ struct GridPt;
7368
struct DbuPt;
7469
struct DbuRect;
7570

76-
using dbMasterSeq = std::vector<dbMaster*>;
71+
using dbMasterSeq = std::vector<odb::dbMaster*>;
7772

7873
using IRDropByPoint = std::map<odb::Point, double>;
7974
struct GapInfo;
@@ -84,7 +79,7 @@ struct IRDrop;
8479
class Opendp
8580
{
8681
public:
87-
Opendp(dbDatabase* db, Logger* logger);
82+
Opendp(odb::dbDatabase* db, Logger* logger);
8883
~Opendp();
8984

9085
Opendp(const Opendp&) = delete;
@@ -101,7 +96,7 @@ class Opendp
10196
void reportLegalizationStats() const;
10297

10398
void setPaddingGlobal(int left, int right);
104-
void setPadding(dbMaster* master, int left, int right);
99+
void setPadding(odb::dbMaster* master, int left, int right);
105100
void setPadding(odb::dbInst* inst, int left, int right);
106101
void setDebug(std::unique_ptr<dpl::DplObserver>& observer);
107102

@@ -120,7 +115,7 @@ class Opendp
120115
void optimizeMirroring();
121116

122117
// Place decap cells
123-
void addDecapMaster(dbMaster* decap_master, double decap_cap);
118+
void addDecapMaster(odb::dbMaster* decap_master, double decap_cap);
124119
void insertDecapCells(double target, IRDropByPoint& psm_ir_drops);
125120

126121
// Get the instance adjacent to the left or right of a given instance
@@ -150,7 +145,7 @@ class Opendp
150145
// gap -> sequence of masters to fill the gap
151146
using GapFillers = std::vector<dbMasterSeq>;
152147

153-
using MasterByImplant = std::map<dbTechLayer*, dbMasterSeq>;
148+
using MasterByImplant = std::map<odb::dbTechLayer*, dbMasterSeq>;
154149

155150
using YCoordToGap = std::map<DbuY, std::vector<GapInfo*>>;
156151

@@ -278,7 +273,7 @@ class Opendp
278273
dbMasterSeq filterFillerMasters(const dbMasterSeq& filler_masters) const;
279274
MasterByImplant splitByImplant(const dbMasterSeq& filler_masters);
280275
void setGridCells();
281-
dbMasterSeq& gapFillers(dbTechLayer* implant,
276+
dbMasterSeq& gapFillers(odb::dbTechLayer* implant,
282277
GridX gap,
283278
const MasterByImplant& filler_masters_by_implant);
284279
void placeRowFillers(GridY row,
@@ -292,7 +287,9 @@ class Opendp
292287
std::vector<int> findDecapCellIndices(const DbuX& gap_width,
293288
const double& current,
294289
const double& target);
295-
void insertDecapInPos(dbMaster* master, const DbuX& pos_x, const DbuY& pos_y);
290+
void insertDecapInPos(odb::dbMaster* master,
291+
const DbuX& pos_x,
292+
const DbuY& pos_y);
296293
void insertDecapInRow(const std::vector<GapInfo*>& gaps,
297294
DbuY gap_y,
298295
DbuX irdrop_x,
@@ -309,7 +306,7 @@ class Opendp
309306
void setGridLoc(Node* cell, GridX x, GridY y);
310307

311308
Logger* logger_ = nullptr;
312-
dbDatabase* db_ = nullptr;
309+
odb::dbDatabase* db_ = nullptr;
313310
odb::dbBlock* block_ = nullptr;
314311
odb::Rect core_;
315312

@@ -331,8 +328,8 @@ class Opendp
331328

332329
// Filler placement.
333330
// gap (in sites) -> seq of masters by implant
334-
std::map<dbTechLayer*, GapFillers> gap_fillers_;
335-
std::map<dbMaster*, int> filler_count_;
331+
std::map<odb::dbTechLayer*, GapFillers> gap_fillers_;
332+
std::map<odb::dbMaster*, int> filler_count_;
336333
bool have_fillers_ = false;
337334

338335
// Decap placement.

src/dpl/src/FillerPlacement.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "infrastructure/Grid.h"
1010
#include "infrastructure/Objects.h"
1111
#include "infrastructure/network.h"
12+
#include "odb/db.h"
1213
#include "odb/dbTypes.h"
1314
#include "utl/Logger.h"
1415

@@ -23,7 +24,7 @@ using odb::dbPlacementStatus;
2324

2425
using utl::format_as;
2526

26-
static dbTechLayer* getImplant(dbMaster* master)
27+
static odb::dbTechLayer* getImplant(dbMaster* master)
2728
{
2829
if (!master) {
2930
return nullptr;
@@ -180,7 +181,7 @@ void Opendp::placeRowFillers(GridY row,
180181
k++;
181182
}
182183

183-
dbTechLayer* implant = nullptr;
184+
odb::dbTechLayer* implant = nullptr;
184185
if (j > 0) {
185186
auto pixel = grid_->gridPixel(j - 1, row);
186187
if (pixel->cell && pixel->cell->getDbInst()) {
@@ -252,7 +253,7 @@ const char* Opendp::gridInstName(GridY row, GridX col)
252253

253254
// Return list of masters to fill gap (in site width units).
254255
dbMasterSeq& Opendp::gapFillers(
255-
dbTechLayer* implant,
256+
odb::dbTechLayer* implant,
256257
GridX gap,
257258
const MasterByImplant& filler_masters_by_implant)
258259
{

src/dpl/src/Opendp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool Opendp::isMultiRow(const Node* cell) const
4545

4646
////////////////////////////////////////////////////////////////
4747

48-
Opendp::Opendp(dbDatabase* db, Logger* logger) : logger_(logger), db_(db)
48+
Opendp::Opendp(odb::dbDatabase* db, Logger* logger) : logger_(logger), db_(db)
4949
{
5050
dummy_cell_ = std::make_unique<Node>();
5151
dummy_cell_->setPlaced(true);
@@ -68,7 +68,7 @@ void Opendp::setPadding(odb::dbInst* inst, const int left, const int right)
6868
padding_->setPadding(inst, GridX{left}, GridX{right});
6969
}
7070

71-
void Opendp::setPadding(dbMaster* master, const int left, const int right)
71+
void Opendp::setPadding(odb::dbMaster* master, const int left, const int right)
7272
{
7373
padding_->setPadding(master, GridX{left}, GridX{right});
7474
}

src/dpl/src/Place.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ bool Opendp::checkPixels(const Node* cell,
894894
return false;
895895
}
896896

897-
dbSite* site = cell->getSite();
897+
odb::dbSite* site = cell->getSite();
898898
for (GridY y1 = y; y1 < y_end; y1++) {
899899
const bool first_row = (y1 == y);
900900
for (GridX x1 = x; x1 < x_end; x1++) {
@@ -1229,7 +1229,7 @@ void Opendp::placeCell(Node* cell, const GridX x, const GridY y)
12291229
setGridLoc(cell, x, y);
12301230
grid_->paintPixel(cell);
12311231
cell->setPlaced(true);
1232-
dbSite* site = cell->getDbInst()->getMaster()->getSite();
1232+
odb::dbSite* site = cell->getDbInst()->getMaster()->getSite();
12331233
cell->setOrient(grid_->getSiteOrientation(x, y, site).value());
12341234
if (journal_) {
12351235
MoveCellAction action(cell,

src/dpl/src/PlacementDRC.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "infrastructure/Padding.h"
1212
#include "odb/db.h"
1313
#include "odb/dbTransform.h"
14+
#include "odb/dbTypes.h"
1415
#include "odb/geom.h"
1516

1617
namespace dpl {
@@ -194,6 +195,8 @@ bool PlacementDRC::checkDRC(const Node* cell,
194195
namespace {
195196
bool isCrWtBlClass(const Node* cell)
196197
{
198+
using odb::dbMasterType;
199+
197200
dbMasterType type = cell->getDbInst()->getMaster()->getType();
198201
// Use switch so if new types are added we get a compiler warning.
199202
switch (type.getValue()) {
@@ -245,8 +248,8 @@ bool isCrWtBlClass(const Node* cell)
245248

246249
bool isWellTap(const Node* cell)
247250
{
248-
dbMasterType type = cell->getDbInst()->getMaster()->getType();
249-
return type == dbMasterType::CORE_WELLTAP;
251+
odb::dbMasterType type = cell->getDbInst()->getMaster()->getType();
252+
return type == odb::dbMasterType::CORE_WELLTAP;
250253
}
251254

252255
bool allowOverlap(const Node* cell1, const Node* cell2)

src/dpl/src/dbToOpendp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void Opendp::createArchitecture()
182182
// error.
183183
continue;
184184
}
185-
dbSite* site = row->getSite();
185+
odb::dbSite* site = row->getSite();
186186
if (site->getHeight() > min_row_height) {
187187
skip_list[site->getHeight()].insert(site->getName());
188188
continue;

src/dpl/src/infrastructure/DecapObjects.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "Coordinates.h"
77
#include "dpl/Opendp.h"
8+
#include "odb/db.h"
89

910
namespace dpl {
1011

@@ -22,9 +23,9 @@ struct GapInfo
2223

2324
struct DecapCell
2425
{
25-
dbMaster* master;
26+
odb::dbMaster* master;
2627
double capacitance;
27-
DecapCell(dbMaster* master, double& capacitance)
28+
DecapCell(odb::dbMaster* master, double& capacitance)
2829
: master(master), capacitance(capacitance)
2930
{
3031
}

src/dpl/src/infrastructure/Grid.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void Grid::markBlocked(odb::dbBlock* block)
213213
}
214214
}
215215

216-
void Grid::initGrid(dbDatabase* db,
216+
void Grid::initGrid(odb::dbDatabase* db,
217217
odb::dbBlock* block,
218218
std::shared_ptr<Padding> padding,
219219
int max_displacement_x,
@@ -228,10 +228,10 @@ void Grid::initGrid(dbDatabase* db,
228228
markBlocked(block);
229229
}
230230

231-
std::pair<dbSite*, odb::dbOrientType> Grid::getShortestSite(GridX grid_x,
232-
GridY grid_y)
231+
std::pair<odb::dbSite*, odb::dbOrientType> Grid::getShortestSite(GridX grid_x,
232+
GridY grid_y)
233233
{
234-
dbSite* selected_site = nullptr;
234+
odb::dbSite* selected_site = nullptr;
235235
odb::dbOrientType selected_orient;
236236
DbuY min_height{std::numeric_limits<int>::max()};
237237

@@ -252,9 +252,8 @@ std::pair<dbSite*, odb::dbOrientType> Grid::getShortestSite(GridX grid_x,
252252
return {selected_site, selected_orient};
253253
}
254254

255-
std::optional<odb::dbOrientType> Grid::getSiteOrientation(GridX x,
256-
GridY y,
257-
dbSite* site) const
255+
std::optional<odb::dbOrientType>
256+
Grid::getSiteOrientation(GridX x, GridY y, odb::dbSite* site) const
258257
{
259258
const RowSitesMap& sites_map = row_sites_[y.v];
260259
auto interval_it = sites_map.find(x.v);
@@ -365,7 +364,7 @@ void Grid::visitCellBoundaryPixels(
365364
}
366365
};
367366

368-
dbMaster* master = inst->getMaster();
367+
odb::dbMaster* master = inst->getMaster();
369368
auto obstructions = master->getObstructions();
370369
bool have_obstructions = false;
371370
const odb::Rect core = getCore();
@@ -689,10 +688,10 @@ void Grid::examineRows(odb::dbBlock* block)
689688
block_ = block;
690689
has_hybrid_rows_ = false;
691690
bool has_non_hybrid_rows = false;
692-
dbSite* first_site = nullptr;
691+
odb::dbSite* first_site = nullptr;
693692

694693
visitDbRows(block, [&](odb::dbRow* row) {
695-
dbSite* site = row->getSite();
694+
odb::dbSite* site = row->getSite();
696695
if (site->isHybrid()) {
697696
has_hybrid_rows_ = true;
698697
} else {
@@ -768,7 +767,7 @@ std::unordered_set<int> Grid::getRowCoordinates() const
768767
return coords;
769768
}
770769

771-
bool Grid::isMultiHeight(dbMaster* master) const
770+
bool Grid::isMultiHeight(odb::dbMaster* master) const
772771
{
773772
if (uniform_row_height_) {
774773
return master->getHeight() > uniform_row_height_.value();

src/dpl/src/infrastructure/Grid.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
namespace dpl {
2525

26-
using odb::dbSite;
27-
2826
struct GridIntervalX
2927
{
3028
GridX lo;
@@ -69,7 +67,7 @@ class Grid
6967
public:
7068
void init(Logger* logger) { logger_ = logger; }
7169
void setCore(const odb::Rect& core) { core_ = core; }
72-
void initGrid(dbDatabase* db,
70+
void initGrid(odb::dbDatabase* db,
7371
odb::dbBlock* block,
7472
std::shared_ptr<Padding> padding,
7573
int max_displacement_x,
@@ -139,9 +137,9 @@ class Grid
139137

140138
std::optional<odb::dbOrientType> getSiteOrientation(GridX x,
141139
GridY y,
142-
dbSite* site) const;
143-
std::pair<dbSite*, odb::dbOrientType> getShortestSite(GridX grid_x,
144-
GridY grid_y);
140+
odb::dbSite* site) const;
141+
std::pair<odb::dbSite*, odb::dbOrientType> getShortestSite(GridX grid_x,
142+
GridY grid_y);
145143

146144
void resize(int size) { pixels_.resize(size); }
147145
void resize(GridY size) { pixels_.resize(size.v); }
@@ -155,11 +153,11 @@ class Grid
155153
odb::Rect getCore() const { return core_; }
156154
bool cellFitsInCore(Node* cell) const;
157155

158-
bool isMultiHeight(dbMaster* master) const;
156+
bool isMultiHeight(odb::dbMaster* master) const;
159157

160158
private:
161159
// Maps a site to the right orientation to use in a given row
162-
using SiteToOrientation = std::map<dbSite*, odb::dbOrientType>;
160+
using SiteToOrientation = std::map<odb::dbSite*, odb::dbOrientType>;
163161

164162
// Used to combine the SiteToOrientation for two intervals when merged
165163
template <typename MapType>

src/dpl/src/infrastructure/Objects.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ void Master::setTopPowerType(const int top_pwr)
7676
{
7777
top_pwr_ = top_pwr;
7878
}
79-
void Master::setDbMaster(dbMaster* db_master)
79+
void Master::setDbMaster(odb::dbMaster* db_master)
8080
{
8181
db_master_ = db_master;
8282
}
83-
dbMaster* Master::getDbMaster() const
83+
odb::dbMaster* Master::getDbMaster() const
8484
{
8585
return db_master_;
8686
}
@@ -163,7 +163,7 @@ bool Node::isHold() const
163163
{
164164
return hold_;
165165
}
166-
dbSite* Node::getSite() const
166+
odb::dbSite* Node::getSite() const
167167
{
168168
if (!getDbInst() || !getDbInst()->getMaster()) {
169169
return nullptr;
@@ -182,17 +182,17 @@ DbuX Node::siteWidth() const
182182
}
183183
bool Node::isHybrid() const
184184
{
185-
dbSite* site = getSite();
185+
odb::dbSite* site = getSite();
186186
return site ? site->isHybrid() : false;
187187
}
188188
bool Node::isHybridParent() const
189189
{
190-
dbSite* site = getSite();
190+
odb::dbSite* site = getSite();
191191
return site ? site->hasRowPattern() : false;
192192
}
193193
int64_t Node::area() const
194194
{
195-
dbMaster* master = getDbInst()->getMaster();
195+
odb::dbMaster* master = getDbInst()->getMaster();
196196
return int64_t(master->getWidth()) * master->getHeight();
197197
}
198198
std::string Node::name() const
@@ -238,7 +238,7 @@ bool Node::isStdCell() const
238238
bool Node::isBlock() const
239239
{
240240
return getDbInst()
241-
&& getDbInst()->getMaster()->getType() == dbMasterType::BLOCK;
241+
&& getDbInst()->getMaster()->getType() == odb::dbMasterType::BLOCK;
242242
}
243243
Group* Node::getGroup() const
244244
{

0 commit comments

Comments
 (0)