mirror of
https://github.com/verilator/verilator.git
synced 2025-04-05 04:02:37 +00:00
Fix table optimizing logic with side effect (#5137 prep)
This commit is contained in:
parent
85356f464f
commit
8bffb8c391
@ -107,7 +107,7 @@ private:
|
||||
bool m_anyAssignDly; ///< True if found a delayed assignment
|
||||
bool m_anyAssignComb; ///< True if found a non-delayed assignment
|
||||
bool m_inDlyAssign; ///< Under delayed assignment
|
||||
bool m_isOutputter; // Creates output
|
||||
bool m_isImpure; // Not pure
|
||||
int m_instrCount; ///< Number of nodes
|
||||
int m_dataCount; ///< Bytes of data
|
||||
AstJumpGo* m_jumpp = nullptr; ///< Jump label we're branching from
|
||||
@ -214,7 +214,7 @@ public:
|
||||
AstNode* whyNotNodep() const { return m_whyNotNodep; }
|
||||
|
||||
bool isAssignDly() const { return m_anyAssignDly; }
|
||||
bool isOutputter() const { return m_isOutputter; }
|
||||
bool isImpure() const { return m_isImpure; }
|
||||
int instrCount() const { return m_instrCount; }
|
||||
int dataCount() const { return m_dataCount; }
|
||||
|
||||
@ -359,7 +359,7 @@ private:
|
||||
// UINFO(9, " !predictopt " << nodep << endl);
|
||||
clearOptimizable(nodep, "Isn't predictable");
|
||||
}
|
||||
if (nodep->isOutputter()) m_isOutputter = true;
|
||||
if (!nodep->isPure()) m_isImpure = true;
|
||||
}
|
||||
|
||||
void knownBadNodeType(AstNode* nodep) {
|
||||
@ -1231,7 +1231,7 @@ public:
|
||||
m_anyAssignComb = false;
|
||||
m_anyAssignDly = false;
|
||||
m_inDlyAssign = false;
|
||||
m_isOutputter = false;
|
||||
m_isImpure = false;
|
||||
m_instrCount = 0;
|
||||
m_dataCount = 0;
|
||||
m_jumpp = nullptr;
|
||||
|
@ -209,6 +209,10 @@ private:
|
||||
// Instruction count bytes (ok, it's space also not time :)
|
||||
const double time // max(_, 1), so we won't divide by zero
|
||||
= std::max<double>(chkvis.instrCount() * TABLE_BYTES_PER_INST + chkvis.dataCount(), 1);
|
||||
if (chkvis.isImpure()) chkvis.clearOptimizable(nodep, "Table creates side effects");
|
||||
if (!m_outWidthBytes || !m_inWidthBits) {
|
||||
chkvis.clearOptimizable(nodep, "Table has no outputs");
|
||||
}
|
||||
if (chkvis.instrCount() < TABLE_MIN_NODE_COUNT) {
|
||||
chkvis.clearOptimizable(nodep, "Table has too few nodes involved");
|
||||
}
|
||||
@ -221,12 +225,6 @@ private:
|
||||
if (m_totalBytes > TABLE_TOTAL_BYTES) {
|
||||
chkvis.clearOptimizable(nodep, "Table out of memory");
|
||||
}
|
||||
if (!m_outWidthBytes || !m_inWidthBits) {
|
||||
chkvis.clearOptimizable(nodep, "Table has no outputs");
|
||||
}
|
||||
if (chkvis.isOutputter()) {
|
||||
chkvis.clearOptimizable(nodep, "Table creates display output");
|
||||
}
|
||||
UINFO(4, " Test: Opt=" << (chkvis.optimizable() ? "OK" : "NO") << ", Instrs="
|
||||
<< chkvis.instrCount() << " Data=" << chkvis.dataCount()
|
||||
<< " in width (bits)=" << m_inWidthBits << " out width (bytes)="
|
||||
|
Loading…
Reference in New Issue
Block a user