The previous way of overriding it was relying on calling "setDefault"
on the global registry, which implies global mutable state.
Details
Diff Detail
Event Timeline
Thanks for fixing this. I don't know why it was written the way it was. Do you need to add a subtarget hook here though? The idea of this code is for the command line to override the target prefs. There's already a get/seSchedulingPreference hook in TargetLowering that comes into play when the default command line option is used.
It seems that the DAGLinearizer can't be selected by the get/setSchedulingPreference (see ScheduleDAGSDNodes* createDefaultScheduler).
Like if there are two levels:
- getDefault was used to select the method to create the scheduler
- if the default was not changed (createDefaultScheduler), then a combination of OptLevel, enableMachineScheduler(), and getSchedulingPreference() are used to select one among SourceListDAGScheduler, BURRListDAGScheduler, HybridListDAGScheduler, VLIWDAGScheduler, and ILPListDAGScheduler.
Update after a discussion with Andy, plays better with command line argument.
(I didn't get originally the purpose of the registry)
Let's see what Eric has to say about including TargetSelectionDAGInfo.h from TargetSubtargetInfo.h. I'm not sure that's the right layering.
Otherwise LGTM. Thanks.
When you push this, please send a note to llvm-dev telling people that their out of tree targets should not use the SchedulerRegistry to select a selection DAG scheduler. They should use your hook. It's not a big deal because we don't want people using SelectionDAG scheduler heuristics anyway, but it is a courtesy.
The out-of-tree targets that are using setDefault() right now will necessarily notice when they won't build anymore since setDefault() is deleted ;)
(but OK I'll send an email)
Looks fine to me (realize you've already committed, but you mentioned my name).
-eric