Emit model implementation as loose methods. (#3006)

This patch introduces the concept of 'loose' methods, which semantically
are methods, but are declared as global functions, and are passed an
explicit 'self' pointer. This enables these methods to be declared
outside the class, only when they are needed, therefore removing the
header dependency. The bulk of the emitted model implementation now uses
loose methods.
This commit is contained in:
Geza Lore
2021-06-13 14:33:11 +01:00
committed by GitHub
parent 18cabc369b
commit 60d5f0e86b
48 changed files with 916 additions and 571 deletions
+2 -3
View File
@@ -1754,14 +1754,13 @@ AstActive* OrderVisitor::processMoveOneLogic(const OrderLogicVertex* lvertexp,
if (!newFuncpr && domainp != m_deleteDomainp) {
const string name = cfuncName(modp, domainp, scopep, nodep);
newFuncpr = new AstCFunc(nodep->fileline(), name, scopep);
newFuncpr->argTypes(EmitCBaseVisitor::symClassVar());
newFuncpr->symProlog(true);
newFuncpr->isStatic(false);
newFuncpr->isLoose(true);
newStmtsr = 0;
if (domainp->hasInitial() || domainp->hasSettle()) newFuncpr->slow(true);
scopep->addActivep(newFuncpr);
// Create top call to it
AstCCall* const callp = new AstCCall(nodep->fileline(), newFuncpr);
callp->argTypes("vlSymsp");
// Where will we be adding the call?
AstActive* const newActivep = new AstActive(nodep->fileline(), name, domainp);
newActivep->addStmtsp(callp);