This is an archive of the discontinued LLVM Phabricator instance.

Factor out SelectionDAG's switch analysis and lowering into a separate component
ClosedPublic

Authored by aemerson on May 31 2019, 12:01 PM.

Details

Summary

In order for GlobalISel to re-use the significant amount of analysis and optimization code in SDAG's switch lowering, we first have to extract it and create an interface to be used by both frameworks.

No test changes as it's NFC.

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.May 31 2019, 12:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2019, 12:01 PM
arsenm added a subscriber: arsenm.May 31 2019, 12:05 PM
arsenm added inline comments.
llvm/include/llvm/CodeGen/SwitchLoweringUtils.h
1 ↗(On Diff #202465)

Missing C++ mode comment

qcolombet accepted this revision.Jun 5 2019, 1:26 PM

Hi Amara,

LGTM.

The only comment I have is regarding the new namespace switchop: should we have one, should we have something camel case?
I don't feel strongly about it, just that it feels unusual compared to no namespace or existing camel cases ones ISD, RegAlloc, etc. We have non-camel case ones too, thus up to you.

Cheers,
-Quentin

This revision is now accepted and ready to land.Jun 5 2019, 1:26 PM

Hi Amara,

LGTM.

The only comment I have is regarding the new namespace switchop: should we have one, should we have something camel case?
I don't feel strongly about it, just that it feels unusual compared to no namespace or existing camel cases ones ISD, RegAlloc, etc. We have non-camel case ones too, thus up to you.

Cheers,
-Quentin

Thanks. I had to introduce one to avoid a naming collision with another definition of JumpTable somewhere else in llvm, and I think in general these utilities are so closely related that a namespace is probably useful. I'm open to renaming it though. what about something like SwitchCG?

This revision was automatically updated to reflect the committed changes.