mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-16 13:58:47 +00:00
register.h: Add internal_flag to Pass
Update experimental pass warnings to use a shared function. Reduces repetition, and also allows all of the warning flags to be combined (which at present is just experimental and the new internal). Update `test_*` passes to call `internal()` in their constructors.
This commit is contained in:
parent
f4ad934542
commit
b9485ce094
|
@ -116,7 +116,9 @@ struct MemContentsTest {
|
|||
|
||||
struct FunctionalTestGeneric : public Pass
|
||||
{
|
||||
FunctionalTestGeneric() : Pass("test_generic", "test the generic compute graph") {}
|
||||
FunctionalTestGeneric() : Pass("test_generic", "test the generic compute graph") {
|
||||
internal();
|
||||
}
|
||||
|
||||
void help() override
|
||||
{
|
||||
|
|
|
@ -695,6 +695,23 @@ static string get_cell_name(string name) {
|
|||
return is_code_getter(name) ? name.substr(0, name.length()-1) : name;
|
||||
}
|
||||
|
||||
static void log_warning_flags(Pass *pass) {
|
||||
bool has_warnings = false;
|
||||
const string name = pass->pass_name;
|
||||
if (pass->experimental_flag) {
|
||||
if (!has_warnings) log("\n");
|
||||
has_warnings = true;
|
||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", name.c_str());
|
||||
}
|
||||
if (pass->internal_flag) {
|
||||
if (!has_warnings) log("\n");
|
||||
has_warnings = true;
|
||||
log("WARNING: THE '%s' COMMAND IS INTENDED FOR INTERNAL DEVELOPER USE ONLY.\n", name.c_str());
|
||||
}
|
||||
if (has_warnings)
|
||||
log("\n");
|
||||
}
|
||||
|
||||
static struct CellHelpMessages {
|
||||
dict<string, SimHelper> cell_help;
|
||||
CellHelpMessages() {
|
||||
|
@ -1125,11 +1142,7 @@ struct HelpPass : public Pass {
|
|||
log("=");
|
||||
log("\n");
|
||||
it.second->help();
|
||||
if (it.second->experimental_flag) {
|
||||
log("\n");
|
||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", it.first.c_str());
|
||||
log("\n");
|
||||
}
|
||||
log_warning_flags(it.second);
|
||||
}
|
||||
}
|
||||
else if (args[1] == "-cells") {
|
||||
|
@ -1149,22 +1162,14 @@ struct HelpPass : public Pass {
|
|||
std::ostringstream buf;
|
||||
log_streams.push_back(&buf);
|
||||
it.second->help();
|
||||
if (it.second->experimental_flag) {
|
||||
log("\n");
|
||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", it.first.c_str());
|
||||
log("\n");
|
||||
}
|
||||
log_warning_flags(it.second);
|
||||
log_streams.pop_back();
|
||||
write_cmd_rst(it.first, it.second->short_help, buf.str());
|
||||
}
|
||||
}
|
||||
else if (pass_register.count(args[1])) {
|
||||
pass_register.at(args[1])->help();
|
||||
if (pass_register.at(args[1])->experimental_flag) {
|
||||
log("\n");
|
||||
log("WARNING: THE '%s' COMMAND IS EXPERIMENTAL.\n", args[1].c_str());
|
||||
log("\n");
|
||||
}
|
||||
log_warning_flags(pass_register.at(args[1]));
|
||||
}
|
||||
else if (cell_help_messages.contains(args[1])) {
|
||||
auto help_cell = cell_help_messages.get(args[1]);
|
||||
|
|
|
@ -68,11 +68,16 @@ struct Pass
|
|||
int call_counter;
|
||||
int64_t runtime_ns;
|
||||
bool experimental_flag = false;
|
||||
bool internal_flag = false;
|
||||
|
||||
void experimental() {
|
||||
experimental_flag = true;
|
||||
}
|
||||
|
||||
void internal() {
|
||||
internal_flag = true;
|
||||
}
|
||||
|
||||
struct pre_post_exec_state_t {
|
||||
Pass *parent_pass;
|
||||
int64_t begin_ns;
|
||||
|
|
|
@ -117,7 +117,9 @@ void opt_eqpmux(test_pmgen_pm &pm)
|
|||
}
|
||||
|
||||
struct TestPmgenPass : public Pass {
|
||||
TestPmgenPass() : Pass("test_pmgen", "test pass for pmgen") { }
|
||||
TestPmgenPass() : Pass("test_pmgen", "test pass for pmgen") {
|
||||
internal();
|
||||
}
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
|
|
|
@ -243,7 +243,9 @@ static void test_abcloop()
|
|||
}
|
||||
|
||||
struct TestAbcloopPass : public Pass {
|
||||
TestAbcloopPass() : Pass("test_abcloop", "automatically test handling of loops in abc command") { }
|
||||
TestAbcloopPass() : Pass("test_abcloop", "automatically test handling of loops in abc command") {
|
||||
internal();
|
||||
}
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
|
|
|
@ -326,7 +326,9 @@ static void autotest(std::ostream &f, RTLIL::Design *design, int num_iter, int s
|
|||
}
|
||||
|
||||
struct TestAutotbBackend : public Backend {
|
||||
TestAutotbBackend() : Backend("=test_autotb", "generate simple test benches") { }
|
||||
TestAutotbBackend() : Backend("=test_autotb", "generate simple test benches") {
|
||||
internal();
|
||||
}
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
|
|
|
@ -705,7 +705,9 @@ static void run_eval_test(RTLIL::Design *design, bool verbose, bool nosat, std::
|
|||
}
|
||||
|
||||
struct TestCellPass : public Pass {
|
||||
TestCellPass() : Pass("test_cell", "automatically test the implementation of a cell type") { }
|
||||
TestCellPass() : Pass("test_cell", "automatically test the implementation of a cell type") {
|
||||
internal();
|
||||
}
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
|
|
Loading…
Reference in a new issue