Add the preferred alignments in the way done in other targets, namely in <Target>ISelLowering.cpp.
However, using AArch64Subtarget::getProcFamily() is discouraged.
Possible alternatives:
- Make TargetLoweringBase::setPrefFunctionAlignment(), TargetLoweringBase::setPrefLoopAlignment(), etc, public.
- Override the visibility of methods above in AArch64TargetLowering.
- Add equivalent public methods in AArch64TargetLowering wrapping around them.
- Create a parameterizeable SubtargetFeature (?)
- Etc
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.