diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Latency.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Latency.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Latency.cpp b/llvm/tools/llvm-exegesis/lib/Latency.cpp index 12bc8cd32b0..b8452ac35a8 100644 --- a/llvm/tools/llvm-exegesis/lib/Latency.cpp +++ b/llvm/tools/llvm-exegesis/lib/Latency.cpp @@ -42,7 +42,7 @@ llvm::Error LatencyBenchmarkRunner::isInfeasible( return llvm::Error::success(); } -llvm::Expected<SnippetPrototype> +llvm::Expected<CodeTemplate> LatencyBenchmarkRunner::generateTwoInstructionPrototype( const Instruction &Instr) const { std::vector<unsigned> Opcodes; @@ -68,28 +68,27 @@ LatencyBenchmarkRunner::generateTwoInstructionPrototype( setRandomAliasing(Forward, ThisIB, OtherIB); if (!Back.hasImplicitAliasing()) setRandomAliasing(Back, OtherIB, ThisIB); - SnippetPrototype Prototype; - Prototype.Explanation = - llvm::formatv("creating cycle through {0}.", - State.getInstrInfo().getName(OtherOpcode)); - Prototype.Snippet.push_back(std::move(ThisIB)); - Prototype.Snippet.push_back(std::move(OtherIB)); - return std::move(Prototype); + CodeTemplate CT; + CT.Info = llvm::formatv("creating cycle through {0}.", + State.getInstrInfo().getName(OtherOpcode)); + CT.Instructions.push_back(std::move(ThisIB)); + CT.Instructions.push_back(std::move(OtherIB)); + return std::move(CT); } return llvm::make_error<BenchmarkFailure>( "Infeasible : Didn't find any scheme to make the instruction serial"); } -llvm::Expected<SnippetPrototype> -LatencyBenchmarkRunner::generatePrototype(unsigned Opcode) const { +llvm::Expected<CodeTemplate> +LatencyBenchmarkRunner::generateCodeTemplate(unsigned Opcode) const { const auto &InstrDesc = State.getInstrInfo().get(Opcode); if (auto E = isInfeasible(InstrDesc)) return std::move(E); const Instruction Instr(InstrDesc, RATC); - if (auto SelfAliasingPrototype = generateSelfAliasingPrototype(Instr)) - return SelfAliasingPrototype; + if (auto CT = generateSelfAliasingCodeTemplate(Instr)) + return CT; else - llvm::consumeError(SelfAliasingPrototype.takeError()); + llvm::consumeError(CT.takeError()); // No self aliasing, trying to create a dependency through another opcode. return generateTwoInstructionPrototype(Instr); } |