mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 18:13:50 +02:00
Optimize DPI import argument passing (#7704)
Pass inputs to DPI import wrappers by reference (unless fits in a register). This eliminates a lot of temporary constructors/destructors.
This commit is contained in:
@@ -1405,6 +1405,13 @@ class TaskVisitor final : public VNVisitor {
|
||||
unlinkAndClone(nodep, portp, false);
|
||||
portp->funcLocal(true);
|
||||
cfuncp->addArgsp(portp);
|
||||
// Pass inputs to DPI import wrappers by reference, unless fits in register
|
||||
if (cfuncp->dpiImportWrapper() && portp->isReadOnly()) {
|
||||
AstNodeDType* const dtypep = portp->dtypep()->skipRefp();
|
||||
if (dtypep->isCompound() || dtypep->isWide()) {
|
||||
portp->direction(VDirection::CONSTREF);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// "Normal" variable, mark inside function
|
||||
portp->funcLocal(true);
|
||||
|
||||
Reference in New Issue
Block a user