mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-30 05:09:04 +00:00
Remove some unnecessary .c_str() calls to the result of unescape_id()
This commit is contained in:
parent
d276529d46
commit
a1141f1a4c
3 changed files with 20 additions and 20 deletions
|
@ -1012,7 +1012,7 @@ struct XAigerWriter : AigerWriter {
|
||||||
|
|
||||||
for (auto box : minfo.found_blackboxes) {
|
for (auto box : minfo.found_blackboxes) {
|
||||||
log_debug(" - %s.%s (type %s): ", cursor.path().c_str(),
|
log_debug(" - %s.%s (type %s): ", cursor.path().c_str(),
|
||||||
RTLIL::unescape_id(box->name).c_str(),
|
RTLIL::unescape_id(box->name),
|
||||||
log_id(box->type));
|
log_id(box->type));
|
||||||
|
|
||||||
Module *box_module = design->module(box->type), *box_derived;
|
Module *box_module = design->module(box->type), *box_derived;
|
||||||
|
|
|
@ -1241,7 +1241,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
||||||
while (children[0]->simplify(true, 1, -1, false) == true) { }
|
while (children[0]->simplify(true, 1, -1, false) == true) { }
|
||||||
if (children[0]->type != AST_CONSTANT)
|
if (children[0]->type != AST_CONSTANT)
|
||||||
input_error("System function %s called with non-const argument!\n",
|
input_error("System function %s called with non-const argument!\n",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
width_hint = max(width_hint, int(children[0]->asInt(true)));
|
width_hint = max(width_hint, int(children[0]->asInt(true)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1291,7 +1291,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
|
||||||
while (right->simplify(true, 1, -1, false)) { }
|
while (right->simplify(true, 1, -1, false)) { }
|
||||||
if (left->type != AST_CONSTANT || right->type != AST_CONSTANT)
|
if (left->type != AST_CONSTANT || right->type != AST_CONSTANT)
|
||||||
input_error("Function %s has non-constant width!",
|
input_error("Function %s has non-constant width!",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
result_width = abs(int(left->asInt(true) - right->asInt(true)));
|
result_width = abs(int(left->asInt(true) - right->asInt(true)));
|
||||||
}
|
}
|
||||||
width_hint = max(width_hint, result_width);
|
width_hint = max(width_hint, result_width);
|
||||||
|
@ -2237,12 +2237,12 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
|
||||||
|
|
||||||
if (GetSize(children) > 1)
|
if (GetSize(children) > 1)
|
||||||
input_error("System function %s got %d arguments, expected 1 or 0.\n",
|
input_error("System function %s got %d arguments, expected 1 or 0.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), GetSize(children));
|
RTLIL::unescape_id(str), GetSize(children));
|
||||||
|
|
||||||
if (GetSize(children) == 1) {
|
if (GetSize(children) == 1) {
|
||||||
if (children[0]->type != AST_CONSTANT)
|
if (children[0]->type != AST_CONSTANT)
|
||||||
input_error("System function %s called with non-const argument!\n",
|
input_error("System function %s called with non-const argument!\n",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
width = children[0]->asInt(true);
|
width = children[0]->asInt(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1915,7 +1915,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
||||||
|
|
||||||
if (current_scope.at(modname)->type != AST_CELL)
|
if (current_scope.at(modname)->type != AST_CELL)
|
||||||
input_error("Defparam argument `%s . %s` does not match a cell!\n",
|
input_error("Defparam argument `%s . %s` does not match a cell!\n",
|
||||||
RTLIL::unescape_id(modname).c_str(), RTLIL::unescape_id(paramname).c_str());
|
RTLIL::unescape_id(modname), RTLIL::unescape_id(paramname));
|
||||||
|
|
||||||
auto paraset = std::make_unique<AstNode>(location, AST_PARASET, children[1]->clone(), GetSize(children) > 2 ? children[2]->clone() : nullptr);
|
auto paraset = std::make_unique<AstNode>(location, AST_PARASET, children[1]->clone(), GetSize(children) > 2 ? children[2]->clone() : nullptr);
|
||||||
paraset->str = paramname;
|
paraset->str = paramname;
|
||||||
|
@ -3394,11 +3394,11 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
|
|
||||||
if (GetSize(children) != 1 && GetSize(children) != 2)
|
if (GetSize(children) != 1 && GetSize(children) != 2)
|
||||||
input_error("System function %s got %d arguments, expected 1 or 2.\n",
|
input_error("System function %s got %d arguments, expected 1 or 2.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
|
|
||||||
if (!current_always_clocked)
|
if (!current_always_clocked)
|
||||||
input_error("System function %s is only allowed in clocked blocks.\n",
|
input_error("System function %s is only allowed in clocked blocks.\n",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
|
|
||||||
if (GetSize(children) == 2)
|
if (GetSize(children) == 2)
|
||||||
{
|
{
|
||||||
|
@ -3469,11 +3469,11 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
{
|
{
|
||||||
if (GetSize(children) != 1)
|
if (GetSize(children) != 1)
|
||||||
input_error("System function %s got %d arguments, expected 1.\n",
|
input_error("System function %s got %d arguments, expected 1.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
|
|
||||||
if (!current_always_clocked)
|
if (!current_always_clocked)
|
||||||
input_error("System function %s is only allowed in clocked blocks.\n",
|
input_error("System function %s is only allowed in clocked blocks.\n",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
|
|
||||||
auto present = children.at(0)->clone();
|
auto present = children.at(0)->clone();
|
||||||
auto past = clone();
|
auto past = clone();
|
||||||
|
@ -3511,7 +3511,7 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
{
|
{
|
||||||
if (children.size() != 1)
|
if (children.size() != 1)
|
||||||
input_error("System function %s got %d arguments, expected 1.\n",
|
input_error("System function %s got %d arguments, expected 1.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
|
|
||||||
auto buf = children[0]->clone();
|
auto buf = children[0]->clone();
|
||||||
while (buf->simplify(true, stage, width_hint, sign_hint)) { }
|
while (buf->simplify(true, stage, width_hint, sign_hint)) { }
|
||||||
|
@ -3538,11 +3538,11 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
if (str == "\\$dimensions" || str == "\\$unpacked_dimensions" || str == "\\$bits") {
|
if (str == "\\$dimensions" || str == "\\$unpacked_dimensions" || str == "\\$bits") {
|
||||||
if (children.size() != 1)
|
if (children.size() != 1)
|
||||||
input_error("System function %s got %d arguments, expected 1.\n",
|
input_error("System function %s got %d arguments, expected 1.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
} else {
|
} else {
|
||||||
if (children.size() != 1 && children.size() != 2)
|
if (children.size() != 1 && children.size() != 2)
|
||||||
input_error("System function %s got %d arguments, expected 1 or 2.\n",
|
input_error("System function %s got %d arguments, expected 1 or 2.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
if (children.size() == 2) {
|
if (children.size() == 2) {
|
||||||
auto buf = children[1]->clone();
|
auto buf = children[1]->clone();
|
||||||
// Evaluate constant expression
|
// Evaluate constant expression
|
||||||
|
@ -3634,18 +3634,18 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
if (func_with_two_arguments) {
|
if (func_with_two_arguments) {
|
||||||
if (children.size() != 2)
|
if (children.size() != 2)
|
||||||
input_error("System function %s got %d arguments, expected 2.\n",
|
input_error("System function %s got %d arguments, expected 2.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
} else {
|
} else {
|
||||||
if (children.size() != 1)
|
if (children.size() != 1)
|
||||||
input_error("System function %s got %d arguments, expected 1.\n",
|
input_error("System function %s got %d arguments, expected 1.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (children.size() >= 1) {
|
if (children.size() >= 1) {
|
||||||
while (children[0]->simplify(true, stage, width_hint, sign_hint)) { }
|
while (children[0]->simplify(true, stage, width_hint, sign_hint)) { }
|
||||||
if (!children[0]->isConst())
|
if (!children[0]->isConst())
|
||||||
input_error("Failed to evaluate system function `%s' with non-constant argument.\n",
|
input_error("Failed to evaluate system function `%s' with non-constant argument.\n",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
int child_width_hint = width_hint;
|
int child_width_hint = width_hint;
|
||||||
bool child_sign_hint = sign_hint;
|
bool child_sign_hint = sign_hint;
|
||||||
children[0]->detectSignWidth(child_width_hint, child_sign_hint);
|
children[0]->detectSignWidth(child_width_hint, child_sign_hint);
|
||||||
|
@ -3656,7 +3656,7 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
while (children[1]->simplify(true, stage, width_hint, sign_hint)) { }
|
while (children[1]->simplify(true, stage, width_hint, sign_hint)) { }
|
||||||
if (!children[1]->isConst())
|
if (!children[1]->isConst())
|
||||||
input_error("Failed to evaluate system function `%s' with non-constant argument.\n",
|
input_error("Failed to evaluate system function `%s' with non-constant argument.\n",
|
||||||
RTLIL::unescape_id(str).c_str());
|
RTLIL::unescape_id(str));
|
||||||
int child_width_hint = width_hint;
|
int child_width_hint = width_hint;
|
||||||
bool child_sign_hint = sign_hint;
|
bool child_sign_hint = sign_hint;
|
||||||
children[1]->detectSignWidth(child_width_hint, child_sign_hint);
|
children[1]->detectSignWidth(child_width_hint, child_sign_hint);
|
||||||
|
@ -3703,7 +3703,7 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
if (str == "\\$countbits") {
|
if (str == "\\$countbits") {
|
||||||
if (children.size() < 2)
|
if (children.size() < 2)
|
||||||
input_error("System function %s got %d arguments, expected at least 2.\n",
|
input_error("System function %s got %d arguments, expected at least 2.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
|
|
||||||
std::vector<RTLIL::State> control_bits;
|
std::vector<RTLIL::State> control_bits;
|
||||||
|
|
||||||
|
@ -3760,7 +3760,7 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
if (str == "\\$countones" || str == "\\$isunknown" || str == "\\$onehot" || str == "\\$onehot0") {
|
if (str == "\\$countones" || str == "\\$isunknown" || str == "\\$onehot" || str == "\\$onehot0") {
|
||||||
if (children.size() != 1)
|
if (children.size() != 1)
|
||||||
input_error("System function %s got %d arguments, expected 1.\n",
|
input_error("System function %s got %d arguments, expected 1.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
|
|
||||||
auto countbits = clone();
|
auto countbits = clone();
|
||||||
countbits->str = "\\$countbits";
|
countbits->str = "\\$countbits";
|
||||||
|
@ -3834,7 +3834,7 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
{
|
{
|
||||||
if (GetSize(children) < 2 || GetSize(children) > 4)
|
if (GetSize(children) < 2 || GetSize(children) > 4)
|
||||||
input_error("System function %s got %d arguments, expected 2-4.\n",
|
input_error("System function %s got %d arguments, expected 2-4.\n",
|
||||||
RTLIL::unescape_id(str).c_str(), int(children.size()));
|
RTLIL::unescape_id(str), int(children.size()));
|
||||||
|
|
||||||
auto node_filename = children[0]->clone();
|
auto node_filename = children[0]->clone();
|
||||||
while (node_filename->simplify(true, stage, width_hint, sign_hint)) { }
|
while (node_filename->simplify(true, stage, width_hint, sign_hint)) { }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue