[NFC][GranCentral] Allow probe outputs from companions

This commit is contained in:
Nandor Licker 2023-10-12 08:36:26 -07:00
parent cbe82b9674
commit 3c42434a3e
1 changed files with 10 additions and 6 deletions

View File

@ -1875,13 +1875,17 @@ void GrandCentralPass::runOnOperation() {
goto FModuleOp_error;
// Companions are only allowed to take inputs.
for (unsigned i = 0, n = instance->getNumResults(); i < n; ++i) {
if (instance->getPortDirection(i) != Direction::In) {
for (auto [i, result] : llvm::enumerate(instance->getResults())) {
if (instance->getPortDirection(i) == Direction::In)
continue;
// Do not allow any outputs in the drop mode.
auto ty = result.getType();
if (ty.isa<RefType>() && companionMode != CompanionMode::Drop)
continue;
op.emitOpError()
<< "companion instance cannot have output ports";
goto FModuleOp_error;
}
}
// If no extraction info was provided, exit. Otherwise, setup the
// lone instance of the companion to be lowered as a bind.