Allow subtarget selection of the default MachineScheduler and document the interface.

The global registry is used to allow command line override of the
scheduler selection, but does not work well as the normal selection
API. For example, the same LLVM process should be able to target
multiple targets or subtargets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191071 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick
2013-09-20 05:14:41 +00:00
parent c87f9488b8
commit f45edcc381
6 changed files with 119 additions and 38 deletions

View File

@ -23,8 +23,10 @@ namespace llvm {
class FunctionPass;
class MachineFunctionPass;
struct MachineSchedContext;
class PassInfo;
class PassManagerBase;
class ScheduleDAGInstrs;
class TargetLoweringBase;
class TargetLowering;
class TargetRegisterClass;
@ -204,6 +206,20 @@ public:
/// Fully developed targets will not generally override this.
virtual void addMachinePasses();
/// createTargetScheduler - Create an instance of ScheduleDAGInstrs to be run
/// within the standard MachineScheduler pass for this function and target at
/// the current optimization level.
///
/// This can also be used to plug a new MachineSchedStrategy into an instance
/// of the standard ScheduleDAGMI:
/// return new ScheduleDAGMI(C, new MyStrategy(C))
///
/// Return NULL to select the default (generic) machine scheduler.
virtual ScheduleDAGInstrs *
createMachineScheduler(MachineSchedContext *C) const {
return 0;
}
protected:
// Helper to verify the analysis is really immutable.
void setOpt(bool &Opt, bool Val);