This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Move function to get subregister indexes to cover a LaneMask
ClosedPublic

Authored by arsenm on Dec 16 2020, 5:57 AM.

Details

Reviewers
qcolombet
foad
Summary

Return the best covering index, and additional needed to complete the
mask. This logically belongs in TargetRegisterInfo, although I ended
up not needing it for why I originally split this out.

Diff Detail

Event Timeline

arsenm created this revision.Dec 16 2020, 5:57 AM
arsenm requested review of this revision.Dec 16 2020, 5:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2020, 5:57 AM
Herald added a subscriber: wdng. · View Herald Transcript
foad accepted this revision.Dec 16 2020, 6:20 AM

Seems like an obvious refactoring to me. I think the API could be simplified though. How about returning all indices via the SmallVector, and returning a bool failure indication? Or say that if the vector is empty, it means failure?

llvm/include/llvm/CodeGen/TargetRegisterInfo.h
361–362

Maybe "the additional ones will be returned in" would be clearer?

This revision is now accepted and ready to land.Dec 16 2020, 6:20 AM

Seems like an obvious refactoring to me. I think the API could be simplified though. How about returning all indices via the SmallVector, and returning a bool failure indication? Or say that if the vector is empty, it means failure?

I was conflicted about this, but thought returning the single "best" one was useful information

Seems like an obvious refactoring to me. I think the API could be simplified though. How about returning all indices via the SmallVector, and returning a bool failure indication? Or say that if the vector is empty, it means failure?

I was conflicted about this, but thought returning the single "best" one was useful information

I think the weirder part of the current API is the "best" one isn't included in the complete vector

ping @qcolombet for API opinion

qcolombet added inline comments.Feb 3 2021, 11:21 AM
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
366

The API looks fine but I think the comment could be clearer.

E.g., what is the best matching index when we need more than one indexes?

Maybe we could return a bool: a covering exists or not, and just always fill Indexes?

arsenm closed this revision.Feb 15 2021, 2:05 PM

d696f43bd760c2623bd6da5e5d90289b1639f3bf