Skip to content

[FIRRTL] Extend emitConnect to open aggregates.#10017

Open
dtzSiFive wants to merge 1 commit intollvm:mainfrom
dtzSiFive:fix/emitconnect-openagg
Open

[FIRRTL] Extend emitConnect to open aggregates.#10017
dtzSiFive wants to merge 1 commit intollvm:mainfrom
dtzSiFive:fix/emitconnect-openagg

Conversation

@dtzSiFive
Copy link
Contributor

Refactor aggregate handling to common helper.

Refactor aggregate handling to common helper.
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't exactly love the templating and I've been trying to think of a way out of it. I can't think of a good alternative that doesn't have a bunch of duplication.

builder.restoreInsertionPoint(locBuilder.saveInsertionPoint());
}

template <typename ATy, typename IndexOp, bool isBundle /* check flip? */>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the PR clarify what the inline comment means? I think this is saying that if isBundle is true, then it will check for flips. (I'm intentionally not reading the later code just yet.) If that is what it is, then maybe this should be checkFlip. WDYT?

After reading the rest of the code, I think isBundle is correct! Disregard.

Comment on lines +79 to +82
if constexpr (isBundle) {
if (dstAggTy.getElement(i).isFlip)
std::swap(dstField, srcField);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
if constexpr (isBundle) {
if (dstAggTy.getElement(i).isFlip)
std::swap(dstField, srcField);
}
if constexpr (isBundle && dstAggTy.getElement(i).isFlip)
std::swap(dstField, srcField);

builder, dst, dstFType, src, srcFType)) &&
failed(
connectIfAggregates<OpenVectorType, OpenSubindexOp, false>(
builder, dst, dstFType, src, srcFType))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of a nit, but I'm trying to see if there is a way to avoid templating here... The best that I can come up with is that switching the if/else checks to use TypeSwitch would give the PR the outer template parameter for free. Not blocking, just something to consider. This is also a larger change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants