From 8ca7a6da2525463be5be4ee9f62cfae0acc06b01 Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Sat, 14 Jul 2018 11:10:59 +0100 Subject: clang-format --- common/nextpnr.cc | 11 ++------ common/nextpnr.h | 72 +++++++++++++++++++-------------------------------- common/place_common.h | 6 ++--- common/router1.cc | 1 - 4 files changed, 30 insertions(+), 60 deletions(-) (limited to 'common') diff --git a/common/nextpnr.cc b/common/nextpnr.cc index 54df5de1..33230db0 100644 --- a/common/nextpnr.cc +++ b/common/nextpnr.cc @@ -21,16 +21,9 @@ NEXTPNR_NAMESPACE_BEGIN -MutateContext BaseCtx::rwproxy(void) -{ - return MutateContext(reinterpret_cast(this)); -} - -ReadContext BaseCtx::rproxy(void) const -{ - return ReadContext(reinterpret_cast(this)); -} +MutateContext BaseCtx::rwproxy(void) { return MutateContext(reinterpret_cast(this)); } +ReadContext BaseCtx::rproxy(void) const { return ReadContext(reinterpret_cast(this)); } assertion_failure::assertion_failure(std::string msg, std::string expr_str, std::string filename, int line) : runtime_error("Assertion failure: " + msg + " (" + filename + ":" + std::to_string(line) + ")"), msg(msg), diff --git a/common/nextpnr.h b/common/nextpnr.h index c3fb913c..6228e653 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -26,7 +27,6 @@ #include #include #include -#include #ifndef NEXTPNR_H #define NEXTPNR_H @@ -261,7 +261,8 @@ class BaseCtx friend class MutateContext; friend class BaseReadCtx; friend class BaseMutateCtx; -private: + + private: mutable boost::shared_mutex mtx_; bool allUiReload = false; @@ -271,7 +272,7 @@ private: std::unordered_set pipUiReload; std::unordered_set groupUiReload; -public: + public: IdString id(const std::string &s) const { return IdString(this, s); } IdString id(const char *s) const { return IdString(this, s); } @@ -311,16 +312,16 @@ public: // locks can be taken while this one still exists. Ie., the UI can draw // elements while the PnR is going a RO operation. ReadContext rproxy(void) const; - }; // State-accessing read-only methods that every architecture object should // contain. class BaseReadCtx { -protected: + protected: const BaseCtx *base_; -public: + + public: BaseReadCtx(const BaseCtx *base) : base_(base) {} }; @@ -328,41 +329,23 @@ public: // contain. class BaseMutateCtx { -protected: + protected: BaseCtx *base_; -public: + public: BaseMutateCtx(BaseCtx *base) : base_(base) {} - void refreshUi(void) - { - base_->allUiReload = true; - } + void refreshUi(void) { base_->allUiReload = true; } - void refreshUiFrame(void) - { - base_->frameUiReload = true; - } + void refreshUiFrame(void) { base_->frameUiReload = true; } - void refreshUiBel(BelId bel) - { - base_->belUiReload.insert(bel); - } + void refreshUiBel(BelId bel) { base_->belUiReload.insert(bel); } - void refreshUiWire(WireId wire) - { - base_->wireUiReload.insert(wire); - } + void refreshUiWire(WireId wire) { base_->wireUiReload.insert(wire); } - void refreshUiPip(PipId pip) - { - base_->pipUiReload.insert(pip); - } + void refreshUiPip(PipId pip) { base_->pipUiReload.insert(pip); } - void refreshUiGroup(GroupId group) - { - base_->groupUiReload.insert(group); - } + void refreshUiGroup(GroupId group) { base_->groupUiReload.insert(group); } UIUpdatesRequired getUIUpdatesRequired(void) { @@ -394,49 +377,46 @@ NEXTPNR_NAMESPACE_BEGIN class ReadContext : public ArchReadMethods { friend class BaseCtx; -private: + + private: boost::shared_mutex *lock_; - ReadContext(const Arch *parent) : ArchReadMethods(parent), lock_(&parent->mtx_) - { - lock_->lock_shared(); - } -public: + ReadContext(const Arch *parent) : ArchReadMethods(parent), lock_(&parent->mtx_) { lock_->lock_shared(); } + + public: ~ReadContext() { if (lock_ != nullptr) { lock_->unlock_shared(); } } - ReadContext(ReadContext &&other): ArchReadMethods(other), lock_(other.lock_) - { - other.lock_ = nullptr; - } + ReadContext(ReadContext &&other) : ArchReadMethods(other), lock_(other.lock_) { other.lock_ = nullptr; } }; // Read proxy to access MutateMethods while holding lock on underlying BaseCtx. class MutateContext : public ArchReadMethods, public ArchMutateMethods { friend class BaseCtx; -private: + + private: boost::shared_mutex *lock_; MutateContext(Arch *parent) : ArchReadMethods(parent), ArchMutateMethods(parent), lock_(&parent->mtx_) { lock_->lock(); } -public: + + public: ~MutateContext() { if (lock_ != nullptr) { lock_->unlock(); } } - MutateContext(MutateContext &&other): ArchReadMethods(other), ArchMutateMethods(other), lock_(other.lock_) + MutateContext(MutateContext &&other) : ArchReadMethods(other), ArchMutateMethods(other), lock_(other.lock_) { other.lock_ = nullptr; } }; - struct Context : Arch { bool verbose = false; diff --git a/common/place_common.h b/common/place_common.h index 96ac48a9..dac2e607 100644 --- a/common/place_common.h +++ b/common/place_common.h @@ -29,8 +29,7 @@ NEXTPNR_NAMESPACE_BEGIN typedef int64_t wirelen_t; // Get the total estimated wirelength for a net -template -wirelen_t get_net_wirelength(const T &proxy, const Context *ctx, const NetInfo *net, float &tns) +template wirelen_t get_net_wirelength(const T &proxy, const Context *ctx, const NetInfo *net, float &tns) { wirelen_t wirelength = 0; int driver_x, driver_y; @@ -81,8 +80,7 @@ wirelen_t get_net_wirelength(const T &proxy, const Context *ctx, const NetInfo * } // Return the wirelength of all nets connected to a cell -template -wirelen_t get_cell_wirelength(const T &proxy, const Context *ctx, const CellInfo *cell) +template wirelen_t get_cell_wirelength(const T &proxy, const Context *ctx, const CellInfo *cell) { std::set nets; for (auto p : cell->ports) { diff --git a/common/router1.cc b/common/router1.cc index f7a7e8a2..dc75a153 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -136,7 +136,6 @@ struct Router int thisVisitCnt = 0; int thisVisitCntLimit = 0; - while (!queue.empty() && (thisVisitCntLimit == 0 || thisVisitCnt < thisVisitCntLimit)) { QueuedWire qw = queue.top(); queue.pop(); -- cgit v1.2.3