[llvm] [TTI] Support scalable offsets in getScalingFactorCost (PR #88113)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 03:35:11 PDT 2024


================
@@ -834,7 +834,7 @@ class TargetTransformInfo {
   /// If the AM is not supported, it returns a negative value.
   /// TODO: Handle pre/postinc as well.
   InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
-                                       int64_t BaseOffset, bool HasBaseReg,
+                                       StackOffset BaseOffset, bool HasBaseReg,
----------------
sdesmalen-arm wrote:

It seems we now have three approaches for passing a 'scalable' and a 'fixed-length' offset to interfaces for this:
1. One using `StackOffset` (this patch for `getScalingFactorCost`)
2. One passing in two separate variables (`isLegalAddressingMode`)
3. Another one with two separate interfaces (`isLegalAddImmediate` vs `isLegalAddScalableImmediate`)

It would be good to settle on a single approach. @paulwalker-arm is there a particular reason you're pushing for (1) for this interface?

If we go for (1), I think we should rename `StackOffset` to `MemOffset` to make it more generic, because in this instance the offset does not necessarily apply only to stack addresses.

https://github.com/llvm/llvm-project/pull/88113


More information about the llvm-commits mailing list