#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/MC/MCSchedule.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <numeric>
usingnamespacellvm;
static cl::opt<bool> EnableSchedModel("schedmodel", cl::Hidden, cl::init(true),
cl::desc("Use TargetSchedModel for latency lookup"));
static cl::opt<bool> EnableSchedItins("scheditins", cl::Hidden, cl::init(true),
cl::desc("Use InstrItineraryData for latency lookup"));
static cl::opt<bool> ForceEnableIntervals(
"sched-model-force-enable-intervals", cl::Hidden, cl::init(false),
cl::desc("Force the use of resource intervals in the schedule model"));
bool TargetSchedModel::hasInstrSchedModel() const { … }
bool TargetSchedModel::hasInstrItineraries() const { … }
void TargetSchedModel::init(const TargetSubtargetInfo *TSInfo) { … }
bool TargetSchedModel::mustBeginGroup(const MachineInstr *MI,
const MCSchedClassDesc *SC) const { … }
bool TargetSchedModel::mustEndGroup(const MachineInstr *MI,
const MCSchedClassDesc *SC) const { … }
unsigned TargetSchedModel::getNumMicroOps(const MachineInstr *MI,
const MCSchedClassDesc *SC) const { … }
static unsigned capLatency(int Cycles) { … }
const MCSchedClassDesc *TargetSchedModel::
resolveSchedClass(const MachineInstr *MI) const { … }
static unsigned findDefIdx(const MachineInstr *MI, unsigned DefOperIdx) { … }
static unsigned findUseIdx(const MachineInstr *MI, unsigned UseOperIdx) { … }
unsigned TargetSchedModel::computeOperandLatency(
const MachineInstr *DefMI, unsigned DefOperIdx,
const MachineInstr *UseMI, unsigned UseOperIdx) const { … }
unsigned
TargetSchedModel::computeInstrLatency(const MCSchedClassDesc &SCDesc) const { … }
unsigned TargetSchedModel::computeInstrLatency(unsigned Opcode) const { … }
unsigned TargetSchedModel::computeInstrLatency(const MCInst &Inst) const { … }
unsigned
TargetSchedModel::computeInstrLatency(const MachineInstr *MI,
bool UseDefaultDefLatency) const { … }
unsigned TargetSchedModel::
computeOutputLatency(const MachineInstr *DefMI, unsigned DefOperIdx,
const MachineInstr *DepMI) const { … }
double
TargetSchedModel::computeReciprocalThroughput(const MachineInstr *MI) const { … }
double
TargetSchedModel::computeReciprocalThroughput(unsigned Opcode) const { … }
double
TargetSchedModel::computeReciprocalThroughput(const MCInst &MI) const { … }
bool TargetSchedModel::enableIntervals() const { … }