[PATCH] D20762: AArch64: Do not test for CPUs, use SubtargetFeatures

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 13:57:53 PDT 2016


MatzeB added a comment.

In http://reviews.llvm.org/D20762#453857, @evandro wrote:

> Not everything is visible at `initializeProperties()`.  For example, were a target to set its own function alignment, `setPrefFunctionAlignment()` cannot be invoked outside of the `TargetLowering` hierarchy.


You could still add an `unsigned PrefFunctionAlignment;` field in SubtargetInfo and then do setPrefFunctionAlignment(Subtarget.getPrefFunctionAlignment());` in the TargetLowering constructor. We already use this tactic for some properties of TargetTransformInfo (CacheLineSize, PrefetchDistance, ...).

It does require adding an extra indirection but I believe it is worth it: Otherwise when you add a new CPU how will you find all the places relevant to your new CPU? What if you want to experiment with code generation pre silicon in simulators (say the next version of your CPU pretty much behaves like the previous one but has no problem with misaligned functions anymore). I also liked the fact how adding a subtarget feature forced you to write a little description...


Repository:
  rL LLVM

http://reviews.llvm.org/D20762





More information about the llvm-commits mailing list