Analysis::Analysis(const Target &Target, std::unique_ptr<MCInstrInfo> InstrInfo,
const InstructionBenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
- bool AnalysisDisplayUnstableOpcodes)
+ bool AnalysisDisplayUnstableOpcodes,
+ const std::string &ForceCpuName)
: Clustering_(Clustering), InstrInfo_(std::move(InstrInfo)),
AnalysisInconsistencyEpsilonSquared_(AnalysisInconsistencyEpsilon *
AnalysisInconsistencyEpsilon),
return;
const InstructionBenchmark &FirstPoint = Clustering.getPoints().front();
+ const std::string CpuName =
+ ForceCpuName.empty() ? FirstPoint.CpuName : ForceCpuName;
RegInfo_.reset(Target.createMCRegInfo(FirstPoint.LLVMTriple));
MCTargetOptions MCOptions;
AsmInfo_.reset(
Target.createMCAsmInfo(*RegInfo_, FirstPoint.LLVMTriple, MCOptions));
- SubtargetInfo_.reset(Target.createMCSubtargetInfo(FirstPoint.LLVMTriple,
- FirstPoint.CpuName, ""));
+ SubtargetInfo_.reset(
+ Target.createMCSubtargetInfo(FirstPoint.LLVMTriple, CpuName, ""));
InstPrinter_.reset(Target.createMCInstPrinter(
Triple(FirstPoint.LLVMTriple), 0 /*default variant*/, *AsmInfo_,
*InstrInfo_, *RegInfo_));
Analysis(const Target &Target, std::unique_ptr<MCInstrInfo> InstrInfo,
const InstructionBenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
- bool AnalysisDisplayUnstableOpcodes);
+ bool AnalysisDisplayUnstableOpcodes,
+ const std::string &ForceCpuName = "");
// Prints a csv of instructions for each cluster.
struct PrintClusters {};
const Analysis Analyzer(*TheTarget, std::move(InstrInfo), Clustering,
AnalysisInconsistencyEpsilon,
- AnalysisDisplayUnstableOpcodes);
+ AnalysisDisplayUnstableOpcodes, CpuName);
maybeRunAnalysis<Analysis::PrintClusters>(Analyzer, "analysis clusters",
AnalysisClustersOutputFile);