forked from OSchip/llvm-project
[llvm-exegesis] Honor -mcpu in analysis mode.
This is useful to set the baseline model for an unknown CPU. Fixes PR50013. Differential Revision: https://reviews.llvm.org/D100743
This commit is contained in:
parent
782b985888
commit
9e9f991ac0
|
@ -154,7 +154,8 @@ void Analysis::printInstructionRowCsv(const size_t PointId,
|
|||
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),
|
||||
|
@ -163,12 +164,14 @@ Analysis::Analysis(const Target &Target, std::unique_ptr<MCInstrInfo> InstrInfo,
|
|||
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_));
|
||||
|
|
|
@ -39,7 +39,8 @@ public:
|
|||
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 {};
|
||||
|
|
|
@ -436,7 +436,7 @@ static void analysisMain() {
|
|||
|
||||
const Analysis Analyzer(*TheTarget, std::move(InstrInfo), Clustering,
|
||||
AnalysisInconsistencyEpsilon,
|
||||
AnalysisDisplayUnstableOpcodes);
|
||||
AnalysisDisplayUnstableOpcodes, CpuName);
|
||||
|
||||
maybeRunAnalysis<Analysis::PrintClusters>(Analyzer, "analysis clusters",
|
||||
AnalysisClustersOutputFile);
|
||||
|
|
Loading…
Reference in New Issue