Optimize temporary insertion in DfgPeephole
This commit is contained in:
parent
93d7d9c417
commit
ffd2c5c69e
|
|
@ -208,6 +208,9 @@ class V3DfgPeephole final : public DfgVisitor {
|
||||||
size_t m_currentGeneration = 0; // Current generation number
|
size_t m_currentGeneration = 0; // Current generation number
|
||||||
size_t m_lastId = 0; // Last unique vertex ID assigned
|
size_t m_lastId = 0; // Last unique vertex ID assigned
|
||||||
size_t m_nTemps = 0; // Number of temporary variables created
|
size_t m_nTemps = 0; // Number of temporary variables created
|
||||||
|
// Scope for transient temporariy variables cerated in this pass. They should all be
|
||||||
|
// eliminated wihtin this pass, so anything should be ok, pick the top scope as easy to find.
|
||||||
|
AstScope* const m_tmpScopep = v3Global.rootp()->topScopep()->scopep();
|
||||||
|
|
||||||
// STATIC STATE
|
// STATIC STATE
|
||||||
static V3DebugBisect s_debugBisect; // Debug aid
|
static V3DebugBisect s_debugBisect; // Debug aid
|
||||||
|
|
@ -1847,10 +1850,9 @@ class V3DfgPeephole final : public DfgVisitor {
|
||||||
DfgSplicePacked* const sp = new DfgSplicePacked{m_dfg, flp, vtxp->dtype()};
|
DfgSplicePacked* const sp = new DfgSplicePacked{m_dfg, flp, vtxp->dtype()};
|
||||||
m_vInfo[sp].m_id = ++m_lastId;
|
m_vInfo[sp].m_id = ++m_lastId;
|
||||||
sp->addDriver(catp, lsb, flp);
|
sp->addDriver(catp, lsb, flp);
|
||||||
DfgVertex::ScopeCache scopeCache;
|
|
||||||
AstScope* const scopep = vtxp->scopep(scopeCache, true);
|
|
||||||
const std::string name = m_dfg.makeUniqueName("PeepholeNarrow", m_nTemps++);
|
const std::string name = m_dfg.makeUniqueName("PeepholeNarrow", m_nTemps++);
|
||||||
DfgVertexVar* const varp = m_dfg.makeNewVar(flp, name, vtxp->dtype(), scopep);
|
DfgVertexVar* const varp
|
||||||
|
= m_dfg.makeNewVar(flp, name, vtxp->dtype(), m_tmpScopep);
|
||||||
varp->tmpForp(varp->vscp());
|
varp->tmpForp(varp->vscp());
|
||||||
m_vInfo[varp].m_id = ++m_lastId;
|
m_vInfo[varp].m_id = ++m_lastId;
|
||||||
varp->vscp()->varp()->isInternal(true);
|
varp->vscp()->varp()->isInternal(true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue