Various fixes for clang/libc++ build (#1415)

* Gowin: add header includes required on libstdc++.

* kernel: fix incorrect printf-style format.

* himbaechel: add missing `override` qualifiers.

* Gowin: remove unnecessary `std::move`.

These calls inhibit RVO, a stronger optimization than moving an object.
This commit is contained in:
Catherine 2025-01-12 07:11:33 +00:00 committed by GitHub
parent 55bd760808
commit 5fe680390f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 13 deletions

View File

@ -35,6 +35,7 @@
#include <iostream> #include <iostream>
#include <random> #include <random>
#include <set> #include <set>
#include <cinttypes>
#include "command.h" #include "command.h"
#include "design_utils.h" #include "design_utils.h"
@ -459,7 +460,7 @@ void CommandHandler::setupContext(Context *ctx)
std::uniform_int_distribution<uint64_t> distrib{1}; std::uniform_int_distribution<uint64_t> distrib{1};
auto seed = distrib(randDev); auto seed = distrib(randDev);
ctx->rngstate = seed; ctx->rngstate = seed;
log_info("Generated random seed: %lu\n", seed); log_info("Generated random seed: %" PRIu64 "\n", seed);
} }
if (vm.count("slack_redist_iter")) { if (vm.count("slack_redist_iter")) {

View File

@ -194,7 +194,7 @@ struct ExampleImpl : HimbaechelAPI
} }
void drawWire(std::vector<GraphicElement> &g, GraphicElement::style_t style, Loc loc, IdString wire_type, void drawWire(std::vector<GraphicElement> &g, GraphicElement::style_t style, Loc loc, IdString wire_type,
int32_t tilewire, IdString tile_type) int32_t tilewire, IdString tile_type) override
{ {
GraphicElement el; GraphicElement el;
el.type = GraphicElement::TYPE_LINE; el.type = GraphicElement::TYPE_LINE;
@ -308,7 +308,7 @@ struct ExampleImpl : HimbaechelAPI
} }
void drawPip(std::vector<GraphicElement> &g, GraphicElement::style_t style, Loc loc, WireId src, IdString src_type, void drawPip(std::vector<GraphicElement> &g, GraphicElement::style_t style, Loc loc, WireId src, IdString src_type,
int32_t src_id, WireId dst, IdString dst_type, int32_t dst_id) int32_t src_id, WireId dst, IdString dst_type, int32_t dst_id) override
{ {
GraphicElement el; GraphicElement el;
el.type = GraphicElement::TYPE_ARROW; el.type = GraphicElement::TYPE_ARROW;
@ -329,7 +329,7 @@ struct ExampleArch : HimbaechelArch
{ {
ExampleArch() : HimbaechelArch("example") {}; ExampleArch() : HimbaechelArch("example") {};
bool match_device(const std::string &device) override { return device == "EXAMPLE"; } bool match_device(const std::string &device) override { return device == "EXAMPLE"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{ {
return std::make_unique<ExampleImpl>(); return std::make_unique<ExampleImpl>();
} }

View File

@ -1,4 +1,5 @@
#include <regex> #include <regex>
#include <map>
#include "himbaechel_api.h" #include "himbaechel_api.h"
#include "himbaechel_helpers.h" #include "himbaechel_helpers.h"
@ -43,9 +44,9 @@ struct GowinImpl : HimbaechelAPI
bool checkPipAvail(PipId pip) const override; bool checkPipAvail(PipId pip) const override;
// Cluster // Cluster
bool isClusterStrict(const CellInfo *cell) const { return true; } bool isClusterStrict(const CellInfo *cell) const override { return true; }
bool getClusterPlacement(ClusterId cluster, BelId root_bel, bool getClusterPlacement(ClusterId cluster, BelId root_bel,
std::vector<std::pair<CellInfo *, BelId>> &placement) const; std::vector<std::pair<CellInfo *, BelId>> &placement) const override;
private: private:
HimbaechelHelpers h; HimbaechelHelpers h;
@ -109,7 +110,7 @@ struct GowinArch : HimbaechelArch
bool match_device(const std::string &device) override { return device.size() > 2 && device.substr(0, 2) == "GW"; } bool match_device(const std::string &device) override { return device.size() > 2 && device.substr(0, 2) == "GW"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{ {
return std::make_unique<GowinImpl>(); return std::make_unique<GowinImpl>();
} }

View File

@ -1,3 +1,5 @@
#include <map>
#include "design_utils.h" #include "design_utils.h"
#include "log.h" #include "log.h"
#include "nextpnr.h" #include "nextpnr.h"
@ -1738,7 +1740,7 @@ struct GowinPacker
} }
// always prepend first ALU with carry generator block // always prepend first ALU with carry generator block
// three cases: CIN == 0, CIN == 1 and CIN == ? // three cases: CIN == 0, CIN == 1 and CIN == ?
new_cells.push_back(std::move(alu_add_cin_block(ctx, ci, cin_net))); new_cells.push_back(alu_add_cin_block(ctx, ci, cin_net));
CellInfo *cin_block_ci = new_cells.back().get(); CellInfo *cin_block_ci = new_cells.back().get();
// CIN block is the cluster root and is always placed in ALU0 // CIN block is the cluster root and is always placed in ALU0
// This is a possible place for further optimization // This is a possible place for further optimization
@ -1784,7 +1786,7 @@ struct GowinPacker
break; break;
} }
if (CellTypePort(*cout_net->users.begin()) != cell_alu_cin || cout_net->users.entries() > 1) { if (CellTypePort(*cout_net->users.begin()) != cell_alu_cin || cout_net->users.entries() > 1) {
new_cells.push_back(std::move(alu_add_cout_block(ctx, ci, cout_net))); new_cells.push_back(alu_add_cout_block(ctx, ci, cout_net));
CellInfo *cout_block_ci = new_cells.back().get(); CellInfo *cout_block_ci = new_cells.back().get();
cin_block_ci->constr_children.push_back(cout_block_ci); cin_block_ci->constr_children.push_back(cout_block_ci);
NPNR_ASSERT(cout_block_ci->cluster == ClusterId()); NPNR_ASSERT(cout_block_ci->cluster == ClusterId());
@ -1807,7 +1809,7 @@ struct GowinPacker
// ALUs are always paired // ALUs are always paired
if (alu_chain_len & 1) { if (alu_chain_len & 1) {
// create dummy cell // create dummy cell
new_cells.push_back(std::move(alu_add_dummy_block(ctx, ci))); new_cells.push_back(alu_add_dummy_block(ctx, ci));
CellInfo *dummy_block_ci = new_cells.back().get(); CellInfo *dummy_block_ci = new_cells.back().get();
cin_block_ci->constr_children.push_back(dummy_block_ci); cin_block_ci->constr_children.push_back(dummy_block_ci);
NPNR_ASSERT(dummy_block_ci->cluster == ClusterId()); NPNR_ASSERT(dummy_block_ci->cluster == ClusterId());
@ -1907,7 +1909,7 @@ struct GowinPacker
// make actual storage cells // make actual storage cells
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
new_cells.push_back(std::move(ssram_make_lut(ctx, ci, i))); new_cells.push_back(ssram_make_lut(ctx, ci, i));
CellInfo *lut_ci = new_cells.back().get(); CellInfo *lut_ci = new_cells.back().get();
ci->constr_children.push_back(lut_ci); ci->constr_children.push_back(lut_ci);
lut_ci->cluster = ci->name; lut_ci->cluster = ci->name;

View File

@ -1060,7 +1060,7 @@ struct NgUltraArch : HimbaechelArch
{ {
NgUltraArch() : HimbaechelArch("ng-ultra") {}; NgUltraArch() : HimbaechelArch("ng-ultra") {};
bool match_device(const std::string &device) override { return device == "NG-ULTRA"; } bool match_device(const std::string &device) override { return device == "NG-ULTRA"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{ {
return std::make_unique<NgUltraImpl>(); return std::make_unique<NgUltraImpl>();
} }

View File

@ -569,7 +569,7 @@ struct XilinxArch : HimbaechelArch
{ {
XilinxArch() : HimbaechelArch("xilinx") {}; XilinxArch() : HimbaechelArch("xilinx") {};
bool match_device(const std::string &device) override { return device.size() > 3 && device.substr(0, 3) == "xc7"; } bool match_device(const std::string &device) override { return device.size() > 3 && device.substr(0, 3) == "xc7"; }
std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) std::unique_ptr<HimbaechelAPI> create(const std::string &device, const dict<std::string, std::string> &args) override
{ {
return std::make_unique<XilinxImpl>(); return std::make_unique<XilinxImpl>();
} }