Page MenuHomePhabricator

[NFCI] Move cost estimation from TargetLowering to TargetTransformInfo.
Needs ReviewPublic

Authored by dfukalov on Jan 19 2022, 2:02 PM.



TragetLowering had two last InstructionCost related getTypeLegalizationCost()
and getScalingFactorCost() members, but all other costs are processed in TTI.

E.g. it is not comfortable to use other TTI members in these two functions
overrided in a target.

Minor refactoring: getTypeLegalizationCost() now doesn't need DataLayout
parameter - it was always passed from TTI.

Diff Detail

Event Timeline

dfukalov created this revision.Jan 19 2022, 2:02 PM
dfukalov added inline comments.Jan 19 2022, 2:10 PM

I'm not sure I should make it virtual (as it was in TLI) and mark it override in targets...


Perhaps TTI::getScalingFactorCost should be unified to TargetLoweringBase::AddrMode AM parameter.

dfukalov published this revision for review.Jan 19 2022, 2:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2022, 2:10 PM

Does anyone else have any comments?


The TTI classes use a CRTP layout - you shouldn't need virtual classes


Not sure about whether that's useful - LoopStrengthReduction seems to be the main user of this, and it has its own data structures. We're going to end up creating the AddrMode structure somewhere, it might as well be here.