This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add preferred alignments for Exynos M1
ClosedPublic

Authored by evandro on Jun 9 2016, 2:43 PM.

Details

Summary

Add the preferred alignments in the way done in other targets, namely in <Target>ISelLowering.cpp.

However, using AArch64Subtarget::getProcFamily() is discouraged.

Possible alternatives:

  1. Make TargetLoweringBase::setPrefFunctionAlignment(), TargetLoweringBase::setPrefLoopAlignment(), etc, public.
  2. Override the visibility of methods above in AArch64TargetLowering.
  3. Add equivalent public methods in AArch64TargetLowering wrapping around them.
  4. Create a parameterizeable SubtargetFeature (?)
  5. Etc

Diff Detail

Repository
rL LLVM

Event Timeline

evandro updated this revision to Diff 60239.Jun 9 2016, 2:43 PM
evandro retitled this revision from to [AArch64] Add preferred alignments for Exynos M1.
evandro updated this object.
evandro set the repository for this revision to rL LLVM.
evandro added a reviewer: rengolin.
evandro added a subscriber: t.p.northover.

The code looks reasonably straightforward, but it ought to be fairly easily testable.

Tim.

MatzeB edited edge metadata.Jun 9 2016, 2:55 PM

This is how I would expect this to look to avoid getProcFamily():

https://ghostbin.com/paste/7cyoa

MatzeB added a comment.Jun 9 2016, 2:56 PM

This is how I would expect this to look to avoid getProcFamily():

https://ghostbin.com/paste/7cyoa

(And just to reduce the amount of code further) We should consider making all those properties in SubTargetInfo public and avoiding the getXXX() accessor functions there.

MatzeB added inline comments.Jun 9 2016, 3:00 PM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
639–646 ↗(On Diff #60239)

The trouble with this is that you will not get a warning once you add a new CPU. (Let's say the successor to ExynosM1 benefits from the same setting). You could slightly improve this by not using default: break; but instead listing all CPUs so that you would at least get a warning about missing entries. Though the cleanest solution IMO is bundling all those per-CPU tweaks in subtarget info as shown in my ghostbin patch.

This is how I would expect this to look to avoid getProcFamily():

https://ghostbin.com/paste/7cyoa

I see. I'll rip it off and update this proposal.

evandro marked an inline comment as done.Jun 9 2016, 3:07 PM

Gotcha!

evandro updated this revision to Diff 60258.Jun 9 2016, 3:20 PM
evandro edited edge metadata.

In order to allow a subtarget to override some alignments, it was also necessary to add support for them in AArch64TargetLowering and AArch64Subtarget, after Matthias Braun's suggestion.

MatzeB accepted this revision.Jun 9 2016, 4:23 PM
MatzeB edited edge metadata.

LGTM, thanks for switching to the "properties in SubTarget" style.

This revision is now accepted and ready to land.Jun 9 2016, 4:23 PM
MatzeB added inline comments.Jun 9 2016, 4:25 PM
llvm/lib/Target/AArch64/AArch64Subtarget.h
89–90 ↗(On Diff #60258)

You can probably use uint8_t instead of unsigned here.

This revision was automatically updated to reflect the committed changes.
evandro added inline comments.Jun 10 2016, 12:08 PM
llvm/lib/Target/AArch64/AArch64Subtarget.h
89–90 ↗(On Diff #60258)

Sorry, I ended up forgetting about this one.