This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Move Localizer::shouldLocalize(..) to TargetLowering
ClosedPublic

Authored by volkan on Feb 26 2020, 12:12 PM.

Details

Summary

Add a new target hook for shouldLocalize so that
targets can customize the logic.

Diff Detail

Event Timeline

volkan created this revision.Feb 26 2020, 12:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2020, 12:13 PM

The change itself is ok but is there any way to have more granular overriding of this behavior, instead of overriding the whole shouldLocalize()?

The change itself is ok but is there any way to have more granular overriding of this behavior, instead of overriding the whole shouldLocalize()?

We can have two functions (one for checking the opcode and another one for the cost), but this doesn't allow targets to localize target specific instruction. That's why I decided move the whole thing to TargetLowering. Do you think having two targets hooks would be better?

aemerson accepted this revision.Feb 28 2020, 1:31 PM

The change itself is ok but is there any way to have more granular overriding of this behavior, instead of overriding the whole shouldLocalize()?

We can have two functions (one for checking the opcode and another one for the cost), but this doesn't allow targets to localize target specific instruction. That's why I decided move the whole thing to TargetLowering. Do you think having two targets hooks would be better?

I suppose this is fine, overriding implementations can just call this base class version if the opcode is something they don't want to override.

This revision is now accepted and ready to land.Feb 28 2020, 1:31 PM