Confusion regarding Processor and ProcessorModel classes in file

There are two classes in file: Processor and ProcessorModel.

  1. What is the difference between these two and what are their use cases ?
  2. What is the ProcessorItineraries ?
    I have attached the code for refernce.
class Processor<string n, ProcessorItineraries pi, list<SubtargetFeature> f,
list<SubtargetFeature> tunef = []> {
// Name - Chip set name. Used by command line (-mcpu=) to determine the
// appropriate target chip.
string Name = n;
// SchedModel - The machine model for scheduling and instruction cost.
SchedMachineModel SchedModel = NoSchedModel;
// ProcItin - The scheduling information for the target processor.
ProcessorItineraries ProcItin = pi;
// Features - list of
list<SubtargetFeature> Features = f;
// TuneFeatures - list of features for tuning for this CPU. If the target
// supports -mtune, this should contain the list of features used to make
// microarchitectural optimization decisions for a given processor. While
// Features should contain the architectural features for the processor.
list<SubtargetFeature> TuneFeatures = tunef;
// ProcessorModel allows subtargets to specify the more general
// SchedMachineModel instead if a ProcessorItinerary. Subtargets will
// gradually move to this newer form.
// Although this class always passes NoItineraries to the Processor
// class, the SchedMachineModel may still define valid Itineraries.
class ProcessorModel<string n, SchedMachineModel m, list<SubtargetFeature> f,
list<SubtargetFeature> tunef = []>
: Processor<n, NoItineraries, f, tunef> {
let SchedModel = m;

Processor is the class describing a given processor in LLVM backend.

One of the components of describing a processor is the ProcessorItineraries. Itineraries are one of LLVM ways to describe scheduling-related information about instructions, that is: which resources do they consume, when their operands are read or written, how many microops do they take, is there any particular bypass, etc… With the processor class, you have to use itineraries. (I think they can be empty perhaps? in which case the schedulers would not do anything?). See for more info.

Alternatively, you can declare your processor using ProcessorModel. Then, you can use the more general SchedMachineModel. The difference is that SchedMachineModel unlocks the more general scheduling constructions, see

Some targets use only itineraries. Some use only the constructions described in Some use both (declaring a SchedMachineModel that uses both, and plugging it through a ProcessorModel)